workerman
workerman copied to clipboard
worker数量与多核心问题
服务器上一共有80个CPU,为什么在配置worker数量为80时测试发并发反而没有配置为8个worker QPS高呢(已启用event扩展)?
配置80个worker时测试结果如下:
root@sbox01:~# wrk -t1000 -c1000 -d30s http://192.168.1.2:80/ --latency
Running 30s test @ http://192.168.1.2:80/
1000 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.54ms 4.63ms 144.98ms 91.58%
Req/Sec 70.52 31.24 414.00 74.71%
Latency Distribution
50% 3.37ms
75% 5.70ms
90% 8.37ms
99% 24.25ms
1586330 requests in 30.10s, 11.98GB read
Socket errors: connect 0, read 334175, write 0, timeout 0
Requests/sec: 52700.09
Transfer/sec: 407.55MB
配置8个worker时测试结果如下:
wrk -t1000 -c1000 -d30s http://192.168.1.2:80/ --latency
Running 30s test @ http://192.168.1.2:80/
1000 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 6.73ms 1.59ms 96.66ms 91.69%
Req/Sec 144.45 24.98 1.28k 96.07%
Latency Distribution
50% 6.73ms
75% 7.09ms
90% 7.61ms
99% 9.34ms
4352469 requests in 30.11s, 27.93GB read
Socket errors: connect 0, read 11, write 0, timeout 0
Requests/sec: 144573.17
Transfer/sec: 0.93GB
是CPU核心太多相互竞争内耗严重导致吗?