Ping vs Packet Loss Explained

Posted on May 17, 2024

Network latency and packet loss are two important metrics that can greatly affect the performance and user experience of applications and services that rely on network communication. This article will explain what latency and packet loss are, how they change network performance, and how to fix problems related to these metrics. We'll also look at real examples and situations to show the real impact of latency and packet loss on different applications.

Key Takeaways

  • Network latency, often called ping, is the round trip time (RTT) for a data packet to go from its source to a destination and back, measured in milliseconds (ms).
  • Packet loss happens when data packets fail to reach their destination, and is measured as a percentage of total packets sent.
  • When diagnosing network issues, focus on the performance at the last hop. If the last hop shows good latency and no packet loss, earlier hop issues can often be ignored.
  • Latency naturally increases with distance between the source and destination. Account for this by subtracting expected travel time (based on the speed of light) from measured latency values.
  • Use tools like ping, traceroute, PingPlotter, mtr, and SmokePing to monitor latency, packet loss, and other key network performance metrics over time. This helps quickly identify and troubleshoot issues.

What is Network Latency (Ping)?

Definition of Network Latency

Network latency, often called ping, is the time a data packet takes to go from its source to a destination and back. This round trip time (RTT) is measured in milliseconds (ms). Latency is an important metric for judging network performance, as it directly affects the speed of applications and services that need network communication.

The distance between the source and destination is a big factor in deciding latency. As data packets must travel through network infrastructure, longer distances usually mean higher latency. This is because the signals carrying the data take more time to move through the network medium, such as copper cables or fiber optic lines.

Example

  1. Online Gaming: In fast online games, low latency is important for a smooth gaming experience. High latency can cause lag, delays in player actions, and reduced competitiveness.

  2. Video Conferencing: Video calls need low latency to ensure real-time communication and minimize delays in audio and video transmission. High latency can lead to pauses, overlapping conversations, and poor video quality.

  3. Financial Trading: In financial trading, even a few milliseconds of latency can make a big difference. Low latency is important for making trades quickly and taking advantage of market opportunities.

  4. Remote Desktop Access: When accessing a remote computer or server, low latency is necessary for a responsive user experience. High latency can cause delays in mouse movements, keyboard input, and screen updates.

Interpreting Latency Data

When looking at latency data, it's important to consider the location of the target servers. Servers that are far from the source will naturally have higher latency compared to servers that are closer. This is an important factor to keep in mind when setting expectations for network performance and finding potential issues.

To account for the impact of distance on latency, you can control for travel time by subtracting the expected propagation delay from the measured latency. The propagation delay can be estimated by multiplying the speed of light by the distance between the source and destination. By doing this, you can separate the latency contributed by other factors, such as network congestion or equipment performance.

When interpreting latency data, pay attention to the latency at the final destination. If the final hop in the network path shows high latency, it indicates a problem that needs to be looked at. High latency at the final destination can lead to slow application response times, poor user experience, and reduced productivity. By finding and fixing the cause of high latency, you can improve overall network performance and ensure that applications and services are running well.

Latency Benchmarks for Common Applications

Application Optimal Latency Range
Online Gaming 20-50 ms
Video Conferencing 150-300 ms
Financial Trading 1-10 ms
Remote Desktop 50-150 ms

What is Packet Loss?

Packet loss happens when data packets fail to reach their destination. It is a percentage of the total packets sent. For example, if 9 out of 100 packets don't make it, the network has a 9% packet loss rate.

Packets can get lost for reasons like:

  • Network congestion: When the network is overloaded, routers may drop packets.
  • Hardware issues: Faulty network equipment can lead to packet loss.
  • Software bugs: Errors in network device software can cause packet mishandling.
  • Signal interference: Wireless networks are prone to interference, which can corrupt or drop packets.

Example

  • During peak hours, a busy public Wi-Fi network at a coffee shop has increased packet loss due to congestion.
  • An old, malfunctioning router in an office network causes packet loss, affecting employee productivity.
  • A software update to a network switch introduces a bug that randomly drops packets, leading to poor performance.
  • In a home Wi-Fi network, a microwave oven interferes with the signal, causing packet loss when in use.

Impact of Packet Loss on Network Performance

While internet protocols handle some packet loss, it can still significantly impact network performance. Here's how different levels affect the user experience:

Packet Loss Impact on User Experience
1% Slight performance degradation. VoIP calls may glitch occasionally.
2-5% Noticeable slowdowns. Video streams may buffer, and online games may lag.
5-10% Significant issues. Web pages take longer to load, and downloads may fail.
Over 10% Network becomes almost unusable. Applications may time out or disconnect.

Any consistent packet loss signals a problem that needs addressing. Even a small percentage of lost packets can cause noticeable issues, especially for real-time applications like video calls and online gaming.

To illustrate packet loss impact, imagine you're talking to someone, but every 10th word is missing. You might piece together the meaning, but it would be frustrating and inefficient. This is similar to how packet loss affects data transmission over a network.

Diagnosing and Fixing Packet Loss

To diagnose packet loss, use tools like ping and traceroute. They send packets to a destination and report on lost packets along the way.

Here's an example using ping to diagnose packet loss:

$ ping example.com 
PING example.com (93.184.216.34): 56 data bytes
64 bytes from 93.184.216.34: icmp_seq=0 ttl=54 time=11.582 ms
64 bytes from 93.184.216.34: icmp_seq=1 ttl=54 time=11.561 ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=54 time=11.839 ms
64 bytes from 93.184.216.34: icmp_seq=3 ttl=54 time=12.340 ms
64 bytes from 93.184.216.34: icmp_seq=4 ttl=54 time=13.451 ms

--- example.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 11.561/12.155/13.451/0.711 ms

If you notice consistent packet loss, take these steps:

graph TD A[Check network hardware] --> B[Restart devices] B --> C[Update device firmware] C --> D[Contact ISP]
  1. Check network hardware: Make sure cables are connected and devices function properly.
  2. Restart devices: Sometimes, restarting your modem, router, or computer can fix packet loss.
  3. Update device firmware: Ensure network devices run the latest firmware.
  4. Contact your ISP: If the issue persists, reach out to your ISP. They can help identify and resolve problems with their network.

Understanding Latency and Packet Loss Data

Look at the Last Hop

When looking at latency and packet loss data, you should look at the performance at the last hop in the network path. If the last hop shows 0% packet loss and good latency, you can usually ignore any problems in the earlier hops.

Non-continuing packet loss, where packet loss shows up in earlier hops but not at the last hop, is often caused by routers having a low priority for processing timed-out ICMP requests. These requests happen when the TTL (Time to Live) value of a packet reaches zero before reaching its destination. In such cases, the router may drop the ICMP "Time Exceeded" response, leading to packet loss in the traceroute or ping output. However, if the packet loss doesn't continue until the last hop, it usually doesn't mean a big problem.

Here's an example of a traceroute output showing non-continuing packet loss:

Hop  RTT      Lost/Sent  Packet Loss  Address
1    1.2 ms   0/3        0%           192.168.1.1
2    12.8 ms  1/3        33%          10.0.0.1
3    8.5 ms   0/3        0%           172.16.0.1
4    15.3 ms  0/3        0%           8.8.8.8

In this example, there is 33% packet loss at hop 2, but the last hop (hop 4) shows no packet loss. This non-continuing packet loss can be ignored as it doesn't affect the overall connection to the last hop.

Finding the Source of Problems

When you see high packet loss and latency at the last hop, you need to look at the rest of the route to find where the problem starts. Start by looking at the hop right before the last hop and work your way back through the network path.

The problem usually starts at the first hop that always shows bad performance, such as high latency or packet loss. By finding this point in the route, you can narrow down the possible causes of the issue and focus your troubleshooting efforts.

Here's an example of a traceroute output showing high latency and packet loss:

Hop  RTT        Lost/Sent  Packet Loss  Address
1    1.2 ms     0/3        0%           192.168.1.1
2    12.8 ms    0/3        0%           10.0.0.1
3    185.5 ms   2/3        66%          172.16.0.1
4    241.3 ms   1/3        33%          8.8.8.8

In this case, the problem starts at hop 3, where there is always high latency (185.5 ms) and packet loss (66%). The issue continues until the last hop (hop 4), pointing to a possible problem in the network path between hop 2 and hop 3.

To make a stronger case for a problem, try to match the latency and packet loss data with specific events or actions. For example, if you notice a spike in latency and packet loss while uploading a large file, it suggests that the issue may be related to network congestion or bandwidth limits. By finding these links, you can gather more proof to support your findings and help find the root cause of the problem.

Distance and Latency

It's important to remember that latency naturally increases with the distance between the source and the destination. As data packets travel through the network, they go through various network elements and links that add delay. The farther the distance between points A and B, the longer it takes for packets to go through the network, resulting in higher latency.

graph TD A[Source] -->|Distance| B[Router 1] B -->|Distance| C[Router 2] C -->|Distance| D[Router 3] D -->|Distance| E[Destination]

When judging latency, think about the location of the target servers compared to your own location. Servers that are far away will naturally have higher latency than servers that are closer to you. Keep this in mind when setting latency limits and comparing latency values across different destinations.

To account for the effect of distance on latency, you can do a more accurate analysis by subtracting the expected travel time from the measured latency. The travel time can be estimated based on the physical distance between the source and destination, assuming that data packets travel at the speed of light through the network medium.

For example, if the distance between your location and the target server is 1000 km, the expected travel time (one-way) would be about:

Travel time = Distance / Speed of light
            = 1000 km / 299,792 km/s 
            ≈ 3.3 ms

By subtracting this travel time from the measured round-trip latency, you can get a more accurate view of the actual network performance, not including the natural delay caused by distance.

Here's a table summarizing the effect of distance on latency:

Distance (km) Expected One-Way Travel Time (ms)
100 0.33
500 1.67
1000 3.33
5000 16.67

Troubleshooting Network Performance Issues

Finding the Problem

When troubleshooting network performance issues, the first step is to find where the problem is happening. Start by looking at the latency and packet loss data for the final destination. If you see high latency or packet loss at the last hop, this is a sign that there is a problem with the network connection.

Here's an example of what high latency and packet loss might look like in a traceroute output:

 1  router.local (192.168.1.1)  1.095 ms  1.008 ms  1.033 ms
 2  10.0.0.1 (10.0.0.1)  8.590 ms  8.551 ms  8.566 ms
 3  * * *
 4  72.14.232.188 (72.14.232.188)  245.665 ms  245.630 ms  245.599 ms
 5  142.251.61.219 (142.251.61.219)  245.516 ms  245.492 ms  245.507 ms
 6  172.253.66.116 (172.253.66.116)  245.451 ms  245.461 ms  245.394 ms
 7  * * *
 8  * * *
 9  * * *
10  * * *

In this example, we see high latency (245 ms) starting at hop 4, and packet loss (shown by asterisks) at hops 7-10. This suggests that the problem is happening somewhere between hops 3 and 4.

Once you've found an issue at the final destination, work your way back through the network path to find where the problem begins. Look for the first hop that consistently shows bad performance, such as high latency or packet loss. This is likely the point where the issue starts.

It's also helpful to match the latency and packet loss data with specific events or actions. For example, if you notice a spike in latency and packet loss when uploading large files, this suggests the problem may be related to network congestion or bandwidth limitations. By finding these patterns, you can gather more evidence to support your findings and help pinpoint the root cause of the issue.

Common Network Performance Issues and Their Symptoms

Issue Symptoms
Network congestion High latency, increased packet loss
Bandwidth limitations Slow transfer speeds, increased latency
Hardware failures Complete loss of connectivity, high packet loss
Software misconfigurations Intermittent connectivity issues, routing problems
ISP network problems High latency, packet loss, slow speeds

Fixing Network Performance Problems

After finding the source of the network performance problem, the next step is to work on fixing the issue. In many cases, this will involve working with network administrators or your Internet Service Provider (ISP) to address the problem.

Network administrators can help optimize network configurations and hardware to improve performance. This may include:

  • Adjusting router settings
  • Upgrading network equipment
  • Using Quality of Service (QoS) policies to prioritize critical traffic

If the issue appears to be with your ISP's network, contact their support team for help. They can run tests and look into the problem from their end, and may need to make repairs or upgrades to their infrastructure to fix the issue.

Another helpful step is to use specialized tools to monitor and analyze network performance over time. Some popular tools for this purpose include:

These tools provide detailed insights into latency, packet loss, and other key metrics. By regularly monitoring your network with these tools, you can quickly find issues as they emerge and take steps to fix them before they impact end-users.