walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.

Home Page:http://www.workerman.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: What http workers do ?

foremtehan opened this issue · comments

In this example:

<?php
Adapterman::init();

$http_worker = new Worker('http://localhost:8080');
$http_worker->count = cpu_count();
$http_worker->name = env('APP_NAME');

...

Can someone explain why we have to create mutiple http workers? I'm new to this idea. If the event loop (async) needs several http workers to manage parallel incoming requests, how is it different from php-fpm? Why it can't use a single thread like node ?

Creating multiple processes can fully utilize the CPU, while using only one process can only utilize one CPU.