Swoole版本:4.3對swoole_websocket_server壓測時,使用這個方法可行嗎?//代碼片段$this->concurrency=100;$this->request=100000;go(function(){for($c=$this->concurrency;$c--;){$cli=new\Swoole\Coroutine\Http\Client('127.0.0.1',9501);$ret=$cli->upgrade('/');if($ret){while($this->requestedrequest){$this->push($cli);$cli->recv();}}}});官方使用的swoole_http_client在4.3版本移除了。另外:使用Task或不使用Task,壓測時會有很大區別嗎,目前本地測著區別不大,是這樣的嗎?//使用Task代碼$this->serv->on('message',function($serv,$frame){$serv->task($frame->data);});$this->serv->on('task',function($serv,$task){foreach($serv->connectionsas$fd){$connectionInfo=$serv->connection_info($fd);if(isset($connectionInfo['websocket_status'])&&intval($connectionInfo['websocket_status'])==3){$serv->push($fd,$task->data);}}});//未使用Task代碼$this->serv->on('message',function($server,$frame){foreach($this->serv->connectionsas$fd){$connectionInfo=$this->serv->connection_info($fd);if(isset($connectionInfo['websocket_status'])&&intval($connectionInfo['websocket_status'])==3){$server->push($fd,$frame->data);}}});機器信息Mac上安裝的ParallelsDesktop虛擬機系統:Ubuntu16.04.3LTS內存:數量:1核數:2CPU:數量:1大?。?GConcurrency:100Requestnum:100000Successnum:100000Totaltime:8.9364Requestpersecond:11190請前輩們指點,這個量級有問題嗎?感謝!
有大佬遇到過這個問題嗎:Swoole 中關于 swoole_websocket_server 壓測的問題。謝謝哈~
楊__羊羊
2019-09-26 08:41:44