Nginx
從遠端伺服器執行 apache bench 的連接時間很慢
我正在嘗試用 ab 衡量 nginx 的性能。從本地機器上做同樣的 ab 給我每秒的請求大約是來自位於同一網路上的遠端機器上的 10 倍。
Local results: Server Software: nginx Server Hostname: 192.168.0.116 Server Port: 8000 Document Path: /data/adpix/picture/test.jpg Document Length: 4602 bytes Concurrency Level: 1000 Time taken for tests: 1.475 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 49854651 bytes HTML transferred: 46622862 bytes Requests per second: 6778.38 [#/sec] (mean) Time per request: 147.528 [ms] (mean) Time per request: 0.148 [ms] (mean, across all concurrent requests) Transfer rate: 33001.34 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 25 67 24.4 66 137 Processing: 28 73 24.9 71 146 Waiting: 13 42 19.7 40 110 Total: 75 140 17.9 139 182
現在從遠端機器:
Server Software: nginx Server Hostname: 192.168.0.116 Server Port: 80 Document Path: /data/adpix/picture/test.jpg Document Length: 4602 bytes Concurrency Level: 1000 Time taken for tests: 14.422 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 51737663 bytes HTML transferred: 48380826 bytes Requests per second: 693.40 [#/sec] (mean) Time per request: 1442.165 [ms] (mean) Time per request: 1.442 [ms] (mean, across all concurrent requests) Transfer rate: 3503.42 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 68 230 182.7 166 3052 Processing: 110 1113 2918.5 227 11862 Waiting: 20 648 2101.1 189 11451 Total: 246 1344 2898.0 387 11981
問題似乎在連接時間內。
網路速度很快。Netperf 返回 80 Mb/s 兩台機器都是託管在 2 台執行四核的不同物理機器上的虛擬機。通過千兆交換機連接。
有人知道可能是什麼問題嗎?
感謝您的任何幫助。
這似乎完全正常,只是由於數據包交換時間和光纖中的光速。是什麼讓你覺得 1.442ms 很“慢”?