猿问

easyswoole中onworkerstart和addprocess的关系?

         $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之间是什么关系呢 ?


烙印99
浏览 954回答 1
1回答
随时随地看视频慕课网APP
我要回答