PHP Swoole is different from the traditional PHP model, it is running in CLI mode more like Node.js but with a different design using coroutines without callback hell.
The differences between PHP Swoole with PHP-FPM the traditional PHP model are:
TCP
, UDP
and UnixSocket
epoll
or kqueue
Master process is the entry point of Swoole Server
.
Reactor threads are created in Master process to handle client side network connection and network I\O.
Manager process create or destory Worker process
and Task Worker process
.
Worker process receive data from Reactor threads and execute business logics, then send back the response to Reactor threads.
Your application code should be run within Worker process.
It is used to process blocking codes
.
Task Worker process receive data from Worker process
and send back the result to the Worker process
.
A Worker process
send data to Task worker process
with: Swoole\Server->task/taskwait/taskCo/taskWaitMulti
A Task worker process
send result back to Worker process
with: Swoole\Server->finish
Interested with PHP Swoole? Get Started with PHP Swoole now!