AMP: Asynchronous Multiprocessing in PHP
AMP parallelizes asynchronous RPC-style function calls to job servers and worker process pools. Its goal is to trivialize distributed PHP processing and failover by eliminating the difficulties of threading and non-blocking semantics. AMP's OS-agnostic functionality is available in both Windows and POSIX environments and requires no additional PHP extensions.
Existing evented PHP libraries require non-blocking semantics for computational concurrency. However, this is a suboptimal solution to the problem of event-driven concurrency because it enforces the use of non-blocking APIs to accomplish anything. Instead, evented code should have access to the vast synchronous toolkit already available to PHP developers. AMP allows developers to write synchronous functions which are then executed and returned asynchronously. This simple approach makes concurrency and distributed processing a reality for PHP coders of any skill level.
- Offers a simple API for parallelizing function calls to job servers and worker processes;
- Supplies a TCP job server for distributed processing in both CLI and web SAPI applications;
- Allows RPC-style calls to worker processes in languages that aren't PHP via a custom inter-process messaging protocol;
- A lightweight threaded
Dispatcherimplementation to parallelize tasks to worker threads using PHP's pthreads extension (as opposed to more heavy-weight worker processes);
- Simplify PHP parallelization and concurrency by minimizing threaded/non-blocking semantics;
- Establish a unified API for multi-processing, multi-threading and distributed processing/failover;
- Build all components using SOLID, readable and thoroughly-tested code.
$ git clone --recursive https://github.com/rdlowrey/Amp.git
$ php composer.phar require rdlowrey/amp:0.2.*