首先參考 http://www.e43q.cn/?p=21 同時(shí)我們?cè)谠瓉?lái)裝MYSQL8的機(jī)器上面,用GCC 9.3.0 來(lái)完成Nginx的編譯工作。
我們先上兩個(gè)版本的效果圖
兩臺(tái)虛擬機(jī)都是8核 4G,ab壓測(cè)下,先上壓測(cè)結(jié)果。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
ab.exe -c5000 -n50000 http://192.168.1.101/ This is ApacheBench, Version 2.3 <$Revision: 1874286 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.1.101 (be patient) Completed 5000 requests ...中間過(guò)程省略 Finished 50000 requests Server Software: nginx/1.18.0 Server Hostname: 192.168.1.101 Server Port: 80 Document Path: / Document Length: 13 bytes Concurrency Level: 5000 Time taken for tests: 28.673 seconds Complete requests: 50000 Failed requests: 0 Total transferred: 12900000 bytes HTML transferred: 650000 bytes Requests per second: 1743.81 [#/sec] (mean) Time per request: 2867.284 [ms] (mean) Time per request: 0.573 [ms] (mean, across all concurrent requests) Transfer rate: 439.36 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 3.7 0 441 Processing: 436 2735 596.6 2776 4248 Waiting: 3 1422 798.3 1414 3775 Total: 436 2735 596.6 2776 4249 Percentage of the requests served within a certain time (ms) 50% 2776 66% 2886 75% 3002 80% 3031 90% 3552 95% 3743 98% 3794 99% 4177 100% 4249 (longest request) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
ab.exe -c5000 -n50000 -k http://192.168.1.101/ This is ApacheBench, Version 2.3 <$Revision: 1874286 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.1.101 (be patient) Completed 5000 requests ...中間過(guò)程省略 Finished 50000 requests Server Software: nginx/1.18.0 Server Hostname: 192.168.1.101 Server Port: 80 Document Path: / Document Length: 13 bytes Concurrency Level: 5000 Time taken for tests: 5.294 seconds Complete requests: 50000 Failed requests: 0 Keep-Alive requests: 50000 Total transferred: 13150000 bytes HTML transferred: 650000 bytes Requests per second: 9444.33 [#/sec] (mean) Time per request: 529.418 [ms] (mean) Time per request: 0.106 [ms] (mean, across all concurrent requests) Transfer rate: 2425.64 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.3 0 17 Processing: 53 396 393.7 263 2262 Waiting: 1 396 393.6 263 2262 Total: 53 396 393.7 263 2262 Percentage of the requests served within a certain time (ms) 50% 263 66% 373 75% 424 80% 493 90% 872 95% 1291 98% 1836 99% 2012 100% 2262 (longest request) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
ab.exe -c5000 -n50000 http://192.168.1.105/ This is ApacheBench, Version 2.3 <$Revision: 1874286 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.1.105 (be patient) Completed 5000 requests ...中間過(guò)程省略 Finished 50000 requests Server Software: nginx/1.18.0 Server Hostname: 192.168.1.105 Server Port: 80 Document Path: / Document Length: 13 bytes Concurrency Level: 5000 Time taken for tests: 27.005 seconds Complete requests: 50000 Failed requests: 0 Total transferred: 12900000 bytes HTML transferred: 650000 bytes Requests per second: 1851.51 [#/sec] (mean) Time per request: 2700.502 [ms] (mean) Time per request: 0.540 [ms] (mean, across all concurrent requests) Transfer rate: 466.49 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.7 0 24 Processing: 486 2563 387.8 2650 2884 Waiting: 1 1317 695.9 1318 2798 Total: 487 2563 387.8 2651 2884 Percentage of the requests served within a certain time (ms) 50% 2651 66% 2667 75% 2682 80% 2691 90% 2765 95% 2823 98% 2845 99% 2863 100% 2884 (longest request) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
ab.exe -c5000 -n50000 -k http://192.168.1.105/ This is ApacheBench, Version 2.3 <$Revision: 1874286 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.1.105 (be patient) Completed 5000 requests ...中間過(guò)程省略 Finished 50000 requests Server Software: nginx/1.18.0 Server Hostname: 192.168.1.105 Server Port: 80 Document Path: / Document Length: 13 bytes Concurrency Level: 5000 Time taken for tests: 5.896 seconds Complete requests: 50000 Failed requests: 0 Keep-Alive requests: 50000 Total transferred: 13150000 bytes HTML transferred: 650000 bytes Requests per second: 8480.82 [#/sec] (mean) Time per request: 589.566 [ms] (mean) Time per request: 0.118 [ms] (mean, across all concurrent requests) Transfer rate: 2178.18 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.3 0 16 Processing: 61 450 421.5 349 2384 Waiting: 0 450 421.4 349 2384 Total: 61 450 421.5 349 2384 Percentage of the requests served within a certain time (ms) 50% 349 66% 415 75% 475 80% 627 90% 976 95% 1408 98% 1949 99% 2153 100% 2384 (longest request) |
我們來(lái)綜合對(duì)比下
IP | GCC版本 | 無(wú)ka | ka | 50%無(wú)ka | 50%有ka |
192.168.1.101 | 4.8.3 | 1743.81 | 9444.33 | 2776ms | 263ms |
192.168.1.105 | 9.3.1 | 1851.51 | 8480.82 | 2651ms | 349ms |
總結(jié):各有千秋,版本高的不一定效果好。這只是一次隨機(jī)壓測(cè)的對(duì)比結(jié)果,效果沒(méi)有權(quán)威性,童鞋們可以多壓測(cè)幾次,然后求平均值,總而達(dá)到嚴(yán)謹(jǐn)?shù)慕Y(jié)果。