What is the relationship between onworkerstart and addprocess in easyswoole?

           $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;$iPP){
               ServerManager::getInstance()->getSwooleServer()->addProcess((new Consumer("consumer_{$i}"))->getProcess());
           }

what is the relationship between them

what is the relationship between onworkerstart and addprocess

when onworkerstart is enabled, 8 worker can be displayed
clipboard.png
of which 4 worker_num and 4 task_worker_num

MAIN_SERVER.SETTING.worker_num = 4
MAIN_SERVER.SETTING.max_request = 5000
MAIN_SERVER.SETTING.task_worker_num = 4

what is the relationship between the added process and the worker?

Php
Apr.17,2022

although the custom process is hosted to the Manager process, it is a more independent process than worker and performs custom functions. OnWorkerStart is executed only when the
worker process and the task process start, so you see 8 outputs

onWorkerStart
addProcess

Menu