PHP Threading Framework
This PHP framework assists developers with building software that:
- Runs a-synchronous and processes multiple data streams in parallel
- Provides high reliability
- Provides high performance and scalability
Threading assists PHP scripts to run multiple threads. The 'threads' created by this library are actually seperate 'processes', which interoperate by using IPC. IPC stands for 'Inter Process Communication', a facility provided by the Linux kernel. The 'Message queue' component of IPC is used to provide a information-exchange path between threads.
Features
- Easy and Flexible set-up
- The 'Threading' class is used to set-up threads and start threading
- Standard threads are provided for thread-management, logging and monitoring
- Multiple user-defined threads can be defined
- Any number of required instances of each thread type can be set
- Communication
- Up to 127 message queues can be used for asynchronous communication
- Any PHP variable can be transferred between threads, up to 16KB in size (class instances are supported too)
- Any thread can become a 'member' of a message queue
- Threads can be allowed READ or WRITE-only access
- Both blocking and non-blocking read/writes modes are supported
- Thread management (MainThread?)
- Tracks all other 'threads' and forks new threads if needed
- Reports global process status to Monitoring
- Logging thread (LoggingThread?)
- Adds Centralized Logging to threading
- Prevents filesystem locking issues and write delays
- Monitoring (MonitoringThread?)
- Status reporting to a Nagios/NCSE server
- Has built-in thresholds, notifications are throttled
- MonitoringMessages? are prioritized
- Template 'consumer' and 'producer' threads (TemplateThreads?)
- Creating new threads is made easy by using the example threads
- Standard methods already provided
- Inter-process message exchange (communicate between threads using messages up to 16KB in size)
- SharedMemory? handling (share data objects between threads)
- Logging
- Thread status reporting to Nagios
- Keepalive reporting to Main thread
- Sleep/wait functions
- Child process handling
- Signal handling
Requirements
- PHP 5.1.4 or higher
- pcntl_wait
History
Versions
1.2
- Added SharedMemory? support
- Added ResponseMessage? support with automatic routing
- Added MonitoringMessage? support allowing any thread to send monitoring messages
1.1
- General code cleanup, replaced global constants with configuration parameters
- Removed lock file (PID file)
- Added ThreadMinimumLifeCycle? mechanism and other MainThread? features
1.0
- Basic thread configuration and startup mechanism
- Support for IPC messages
Known issues
- Main thread head count only counts running threads, so if one thread dies and has reached to many startup failures, it reports an error, but only once.
People
- Project Manager / Developer: Geoffrey de Kleijn <gdk@…>
- Developer: Paul Nijssen <p.nijssen@…>
- Author: David Betgen <db@…>
- Author: Mark Kremer
Trac
About this trac and wiki
Starting Points
- TracGuide -- Built-in Documentation
- The Trac project -- Trac Open Source Project
- Trac FAQ -- Frequently Asked Questions
- TracSupport -- Trac Support
For a complete list of local wiki pages, see TitleIndex.
