在centos7部署了个webman的项目,在windwos环境使用apiPost进行压力测试时会出现部分dial tcp 127.0.0.1: connectex: Only one usage of each socket address (protocol/network address/port) is normally permitted.
的报错,大概占总请求的不到1%。
cs_id 是1到10W,并发数100个,时长180S。
$params = $request->all();
if (empty($params['cs_id'])) {
return json(['code' => 20000, 'msg' => 'id不能为空']);
}
$key = 'CS_ID_' . $params['cs_id'];
$cached_data = Redis::hGetAll($key);
if (!empty($cached_data)) {
return json_encode(['code' => 200, 'msg' => 'success', 'data' => $cached_data]);
}
$data = DB::table('conference')
->select('*')
->where('CS_ID', $params['cs_id'])
->first();
if ($data) {
Redis::hMSet($key, (array)$data);
Redis::expire($key, 600);
return json_encode(['code' => 200, 'msg' => 'success', 'data' => (array)$data]);
} else {
return json_encode(['code' => 200, 'msg' => 'success', 'data' => null]);
}
dial tcp 127.0.0.1: connectex: Only one usage of each socket address (protocol/network address/port) is normally permitted.
"workerman/webman-framework": "^1.6.8"
使用keepalive压测,不然windows压力机的操作系统端口不够用。
压力测试相关参考手册 https://www.workerman.net/doc/webman/others/benchmarks.html
另外 apipost有bug,不建议用它压测,手册里有说
好的好的,感谢