Bandwidth, latency, jitter, and packet loss rate measured in CentOS
When we talk about a good network environment, it usually means that we "feel" to access the website immediately. But if a website is opened for a long time, it must be a poor network environment? Not necessarily, or the website itself may be faulty. If this is your website, you certainly do not want to refresh the page repeatedly, or use a few more computers to access it to "feel" its speed as a basis for determining whether the network is good, we need a more reliable technical means. These indicators are basic indicators for determining whether the server's network is good.
In addition to troubleshooting, we also need to understand these parameters in the following situations:
- Purchase
VPS: Buy one from youVPS, Especially foreignVPSYou will definitely want to know whether you can smoothly access your ownVPSIn particular, whether the bandwidth parameter is consistent with the actual purchase;
- Performance testing: To test the performance of your website, make sure that your network environment meets the requirements of the metrics;
What kind of indicators are qualified?
First, there is no general indicator, and the indicators required for different application scenarios are different. For example, the Network indicators of IP phones, videos, and websites are different, this section only analyzes Website access information.
From the server environment perspective, the server can only control its own bandwidth, but the actual access environment of ordinary users cannot be controlled. What the server needs to do is provide a better experience in a poor environment, this is not the topic of this Article. Therefore, when we talk about indicators, it does not refer to servers.
From the perspective of the user (developer or common user) environment, if a website is (Google Pagespeed InsightIf the network environment meets the requirements, the user can access our website quickly. This is also an empirical indicator, and there is no final conclusion. The following indicators are the indicators I want to perform performance tests. They require higher requirements than normal users to browse websites, therefore, the network environment is okay if this indicator can be met.
- Bandwidth: close to the maximum bandwidth provided by the service provider
- Latency:
<100ms
- Jitter:
<20ms
- Packet Loss Rate:
<1%
Measurement method server bandwidth measurement
UseiperfTool to test the server bandwidth, which is divided into the server and client, both sides must be installediperfTool. InLinuxPassyumOrapt-getYou can directly install it.
Server (assuming
IPIs
106.14.26.11) Run
iperfService:
#iperf -s------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 85.3 KByte (default)
This is where both upstream and downstream bandwidths are close.100Mbits/secServer, the measured value should not deviate too far from this value.
Client
Test upstream and downstream bandwidths
$ Iperf-c 106.14.26.11-t 60-d your Server listening on TCP port 5001TCP window size: 85.3 KByte (default) Your Client connecting to 45.32.64.187, TCP port 5001TCP window size: 197 KByte (default) connector [4] local connector port 50040 connected with 106.14.26.11 port 5001 [5] local 104.250.144.8 port 5001 connected with 106.14.26.11 port 34386 [ID] Interval Transfer Bandwidth [4] 0.0-60.0 sec 658 MBytes 92.0 Mbits/sec # upstream bandwidth [5] 0.0-60.4 sec 628 MBytes 87.4 Mbits/sec # downstream bandwidth
According to the test results, the uplink bandwidth is92.0Mbits/sec, Downstream bandwidth is87.2Mbits/sec, Lower than the server's100Mbits/sec, But not very low.
If your client cannot connectiperfThe server may be blocked by the firewall of the host orVPSProviders impose restrictions. For the formeriptables -FYou can solve the problem. For the latter, there are several solutions:VPSConsole modification and contact of the providerVPSProvider, modify the port to the externally accessible port.
Measure latency, jitter, and Packet Loss Rate
Latency, jitter, and Packet Loss Rate for direct usepingDo the test. If you want to measure this value, we recommend that you100Package tests:
$ Ping-c 100 www. baidu. comPING www.a.shifen.com (163.177.151.109): 56 data bytes64 bytes from 163.177.151.109: icmp_seq = 0 ttl = 55 time = 26.639 ms64 bytes from 163.177.151.109: icmp_seq = 1 ttl = 55 time = 24.329 ms64 bytes from 163.177.151.109: icmp_seq = 2 ttl = 55 time = 24.794 ms64 bytes from 163.177.151.109: icmp_seq = 3 ttl = 55 time = 22.709 ms64 bytes from 163.177.151.109: icmp_seq = 4 ttl = 55 time = 39.994 ms64 Tes from 163.177.151.109: icmp_seq = 5 ttl = 55 time = 50.786 ms... Omit ^ C --- www.a.shifen.com ping statistics --- 100 packets transmitted, 100 packets received, 0.0% packet loss # The last percentage is the packet loss rate round-trip min/avg/max/stddev = 21.505/26.743/50.786/6.613 MS # indicate the minimum latency, average latency, maximum latency and jitter (jitter is the standard deviation of latency)
Based on the above results, we can conclude that:
Latency: 26.743ms jitter: 6.613ms Packet Loss Rate: 0.0%
The access to Baidu must be fast because it meets the metric requirements. (If the bandwidth is correct, the measurement of the server bandwidth requires server support, so it cannot be measured)
References
- Use iperf to test server bandwidth, latency jitter, and packet loss
- Iperf command
- Optimizing performance in ever-changing Networks