$register->add($register::onWorkerStart, function (\swoole_server $server, int $workerId) { var_dump('worker:' . $workerId . 'start'); }); Di::getInstance()->set("REDIS",Redis::getInstance()); $allNum = 10; for ($i = 0 ;$i < $allNum;$i++){ ServerManager::getInstance()->getSwooleServer()->addProcess((new Consumer("consumer_{$i}"))->getProcess()); }
onworkerstart和addprocess 是什么关系呢
onworkerstart 开启后可以显示8个worker
其中4个worker_num和4个task_worker_num
MAIN_SERVER.SETTING.worker_num = 4 MAIN_SERVER.SETTING.max_request = 5000 MAIN_SERVER.SETTING.task_worker_num = 4
添加的进程跟这个worker之间是什么关系呢 ?