远程服务器执行 apache bench 时连接速度很慢

远程服务器执行 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 两台机器都是托管在两台不同的物理机上的 VM,运行四核处理器。通过千兆交换机连接。

有人知道可能是什么问题吗?

感谢您的任何帮助。

答案1

这似乎很正常,只是由于数据包交换时间和光纤中的光速。是什么让你认为 1.442 毫秒“慢”?

相关内容