連線隨機延遲

連線隨機延遲

當我嘗試連接到我朋友的伺服器時,連接似乎隨機滯後,有時是 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可能是您的連線的網路問題的根源。

相關內容