Swoole版本:4.3對swoole_websocket_server壓測時(shí),使用這個(gè)方法可行嗎?//代碼片段$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,壓測時(shí)會有很大區(qū)別嗎,目前本地測著區(qū)別不大,是這樣的嗎?//使用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);}}});機(jī)器信息Mac上安裝的ParallelsDesktop虛擬機(jī)系統(tǒng):Ubuntu16.04.3LTS內(nèi)存:數(shù)量:1核數(shù):2CPU:數(shù)量:1大小:2GConcurrency:100Requestnum:100000Successnum:100000Totaltime:8.9364Requestpersecond:11190請前輩們指點(diǎn),這個(gè)量級有問題嗎?感謝!
求大佬指點(diǎn)哈!關(guān)于 壓測的問題。求指導(dǎo)!
溫溫醬
2019-06-09 08:54:40