左邊是tomcat8-apr 右邊是 jetty9-nio
測試情境2
1. 當Web 收到Request 後,系統會產生一組Async 的CompletableFuture Task 去執行,產生CompletableFuture 使用newCachedThreadPool 。
2. 每個Task (Random 產生時間消耗 300~500 ms)
這次改用Ingram 大大推薦的 wrk 分別測試兩組數據:
wrk -t200 -c 500 -d180
wrk -t300 -c 800 -d180
產生了有趣的結果:
1. 測試機和web 都是A2的機器,wrk 的測試方法真的很操系統 load average: 32.06, 16.47, 12.81
2. tomcat 的記憶體是慢慢往上吃,jetty 是頻繁的GC,但是平均記憶體吃的比較少
3. tomcat 用完Thread 就全部還回去,但是Jetty 卻不會!?
4. 但是數據結果卻不一樣了tomcat-apr 的數據比jetty9-nio的數據好多了?(歪頭...)
(300 threads and 800 connections)
Tomcat8-apr
Thread Stats Avg Stdev Max +/- Stdev
Latency 301.58ms 101.78ms 1.03s 56.89%
Req/Sec 7.18 3.66 20.00 84.98%
358057 requests in 3.00m, 71.51MB read
Requests/sec: 1988.06
Transfer/sec: 406.58KB
Tomcat8-nio2
Thread Stats Avg Stdev Max +/- Stdev
Latency 319.75ms 113.30ms 1.57s 68.91%
Req/Sec 6.84 3.54 20.00 82.86%
338198 requests in 3.00m, 67.55MB read
Requests/sec: 1877.77
Transfer/sec: 384.07KB
Tomcat8-bio
Thread Stats Avg Stdev Max +/- Stdev
Latency 444.86ms 277.30ms 2.00s 74.37%
Req/Sec 5.46 3.50 20.00 58.72%
231600 requests in 3.00m, 46.28MB read
Socket errors: connect 0, read 0, write 0, timeout 2871
Requests/sec: 1285.93
Transfer/sec: 263.12KB
Jetty9-nio
Thread Stats Avg Stdev Max +/- Stdev
Latency 342.94ms 102.00ms 947.28ms 57.53%
Req/Sec 6.18 3.16 20.00 65.20%
305074 requests in 3.00m, 62.63MB read
Requests/sec: 1693.88
Transfer/sec: 356.07KB
不過wrk無法像ab 看出Latency的分布比率,而且根據過往nio 尾端炸裂的結果,的確很有可能把平均拉低,想想不對勁,再使用wrk回去測情境1 (沒有async 工作要做的)
Jetty9-nio
Thread Stats Avg Stdev Max +/- Stdev
Latency 129.37ms 110.58ms 1.53s 86.40%
Req/Sec 16.80 9.94 330.00 70.40%
735275 requests in 3.00m, 139.54MB read
Requests/sec: 4082.55
Transfer/sec: 793.39KB
Tomcat8-apr
Thread Stats Avg Stdev Max +/- Stdev
Latency 164.65ms 98.23ms 1.22s 81.01%
Req/Sec 13.14 6.54 356.00 75.63%
674950 requests in 3.00m, 124.35MB read
Requests/sec: 3747.55
Transfer/sec: 706.99KB
Tomcat8-nio2
Thread Stats Avg Stdev Max +/- Stdev
Latency 382.19ms 319.77ms 2.00s 73.21%
Req/Sec 7.47 5.96 150.00 83.09%
293874 requests in 3.00m, 54.14MB read
Socket errors: connect 0, read 0, write 0, timeout 958
Requests/sec: 1631.67
Transfer/sec: 307.80KB
結果又跟之前ab測試的結果一樣,jetty又有壓倒性勝利!?.....(再歪頭....)
所以在後端有拖慢速度的工作時,tomcat 又勝過Jetty.......
沒有留言:
張貼留言