连接随机延迟

连接随机延迟

当我尝试连接到我朋友的服务器时,连接似乎随机滞后,有时是 50 毫秒、40 毫秒、60 毫秒,但有时需要 1、3 或 7 秒

time curl -vv 'http://ipaddress/foo.json'
* Hostname was NOT found in DNS cache
*   Trying ipaddress... --> SLOW AT THIS LINE !!!
* Connected to ipaddress (ipaddress) port 80 (#0)
> GET /foo.json HTTP/1.1
> User-Agent: curl/7.37.0
> Host: ipaddress
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Tue, 24 Jun 2014 02:51:45 GMT
* Server Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 is not blacklisted
< Server: Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
< Last-Modified: Tue, 24 Jun 2014 02:42:12 GMT
< ETag: "2e8109e-871-4fc8be82affe4"
< Accept-Ranges: bytes
< Content-Length: 2161
< Content-Type: application/json

我怎么知道系统的哪个部分导致了这个问题?

我尝试禁用 mod_bwlimited,但仍然出现延迟

我尝试在另一个端口上使用另一个网络服务器(猴子),它仍然发生

服务器:

Linux bar 2.6.32-042stab090.3 #1 SMP Fri Jun 6 09:35:21 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux

另外,当我尝试更改/etc/sysctl.conf和使用sysctl -proot

net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
fs.file-max = 524288 

表明:

error: permission denied on key 'net.ipv4.tcp_tw_recycle'
error: permission denied on key 'net.ipv4.tcp_tw_reuse'
error: permission denied on key 'fs.file-max'

也许该值受到托管公司的限制?

答案1

当您出现滞后时,请使用mtr检查与服务器的连接。

mtr是一个强大的跟踪路由程序。它连续运行traceroute并生成有意义的网络统计数据,例如丢失数据包的百分比和几个 RTT 指标。

将为您和所选端点之间的每个链接生成统计信息。任何表现出高网络问题的链接Loss%Avg可能是您的连接的网络问题的根源。

相关内容