性能测试
性能测试是一个场景复杂且依赖各种场景的流程,因此下面只是做了简单的测试场景。
CPU: M2
Nginx(无访问日志)
nginx的只是用来做一个比对使用
wrk 'http://127.0.0.1:9080/' --latency
Running 10s test @ http://127.0.0.1:9080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 393.55us 2.39ms 32.81ms 97.72%
Req/Sec 72.68k 5.98k 86.25k 87.13%
Latency Distribution
50% 65.00us
75% 71.00us
90% 78.00us
99% 14.87ms
1460643 requests in 10.10s, 208.95MB read
Requests/sec: 144598.99
Transfer/sec: 20.69MB
Pingap(无访问日志)
wrk 'http://127.0.0.1:6188/ping' --latency
Running 10s test @ http://127.0.0.1:6188/ping
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 66.18us 28.39us 2.30ms 85.24%
Req/Sec 74.43k 1.75k 76.25k 97.03%
Latency Distribution
50% 70.00us
75% 77.00us
90% 83.00us
99% 100.00us
1495363 requests in 10.10s, 195.37MB read
Requests/sec: 148056.28
Transfer/sec: 19.34MB
Pingap转发至nginx
Threads: 1
wrk 'http://127.0.0.1:6188/proxy-nginx' --latency
Running 10s test @ http://127.0.0.1:6188/proxy-nginx
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 206.46us 151.03us 7.28ms 98.62%
Req/Sec 25.06k 1.16k 29.07k 87.13%
Latency Distribution
50% 211.00us
75% 224.00us
90% 239.00us
99% 391.00us
503591 requests in 10.10s, 72.04MB read
Requests/sec: 49862.65
Transfer/sec: 7.13MB
Threads: 2
wrk 'http://127.0.0.1:6188/proxy-nginx' --latency
Running 10s test @ http://127.0.0.1:6188/proxy-nginx
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 161.04us 753.69us 19.29ms 99.23%
Req/Sec 44.96k 2.73k 48.65k 73.76%
Latency Distribution
50% 107.00us
75% 125.00us
90% 143.00us
99% 299.00us
903504 requests in 10.10s, 129.25MB read
Requests/sec: 89449.37
Transfer/sec: 12.80MB
Threads: 3 (设置为3个线程效果比2个线程提升很少,估计有全局的锁之类影响,后续确认)
wrk 'http://127.0.0.1:6188/proxy-nginx' --latency
Running 10s test @ http://127.0.0.1:6188/proxy-nginx
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 111.73us 277.33us 10.84ms 99.54%
Req/Sec 48.06k 3.35k 74.58k 87.56%
Latency Distribution
50% 95.00us
75% 115.00us
90% 134.00us
99% 193.00us
961184 requests in 10.10s, 137.50MB read
Requests/sec: 95160.18
Transfer/sec: 13.61MB
Pingap 响应 8kb 的 html
wrk 'http://127.0.0.1:6188/downloads/index.html' --latency
Running 10s test @ http://127.0.0.1:6188/downloads/index.html
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 225.84us 59.47us 1.83ms 78.04%
Req/Sec 22.17k 1.94k 25.25k 87.13%
Latency Distribution
50% 222.00us
75% 247.00us
90% 286.00us
99% 418.00us
445764 requests in 10.10s, 3.16GB read
Requests/sec: 44134.06
Transfer/sec: 320.01MB