Get the best out of our app
GeeksforGeeks App
Open App
Browser
Continue

# What is Latency?

Being simple latency means whenever you have given input to the system and the total time period it takes to give output so that particular time period/interval is known as latency.

Actually, latency is the in-between handling time of computers, as some of you may think that whenever some system connects with another system it happens directly but no it isn’t, the signal or data follows the proper traceroute for reaching its final destination.

Nowadays fiber optic cables are used for transmitting signals/data from one place to another with the speed of light but obviously before reaching the final destiny the data/signal has to pass many checkpoints or posts and follow a proper traceroute so it takes some time to get respond from the receiver and that total round of time is known as latency.

If you want to know the fastest possible network connection you could have from one place to another then we will suppose light as a medium because light just takes 100 milliseconds(approx.) to take a round of earth. So according to the data if you let light as a medium then you can send 20 packets per second across the other sides of the world.

## Ping

To make you all more clear with that we will use ping here, Ping is nothing just a concept or a solution to check the value of latency generated there in the connection between the systems. Ping checks the value of latency by just sending 4 packets of data to the address provided by the user to check the ping and then calculates the total time when the response comes to it, that total time is called latency.

Ping is checked up for Windows from the command prompt and for MAC from the terminal using the syntax “ping<space>website name”.

Example: Let’s take a real-world example, so here we will ping up 2 websites one near me that is in India named “Tata Consultancy Service” and one overseas that is “Goldman Sachs”, let’s see what happens.

TCS ping with respect to UP(India)

Goldman Sachs ping with respect to UP(India)

Now as you can observe that the maximum latency for “Tata Consultancy Service” is coming up to 44 milliseconds and for “Goldman Sachs” the maximum latency is 53 milliseconds, this is because of the location from where the ping is being originated to measured. You can also say that the ping of any particular website is directly proportional to the distance.

## Types of Latency

• Interrupt Latency: Interrupt Latency can be described as the time that it takes for a computer to act on a signal.
• Fiber Optic Latency: Fiber Optic Latency is the latency that comes from traveling some distance through fiber optic cable.
• Internet Latency: Internet Latency is the type of latency that totally depends on the distance.
• WAN Latency: WAN Latency is the delay that is happened if the resource is requested from a server or another computer or anywhere else.
• Audio Latency: Audio Latency can be easily stated as the delay between the creation of the sound and the hearing of the sound.
• Operational Latency: Operational Latency can be described as the time taken during operations if they are performed in a flow.
• Mechanical Latency: Mechanical Latency is basically the delay that happens from the mechanical device to the output.
• Computer and OS Latency: Combined and OS Latency is simple due to the delay between the input and the output.

## What Causes Internet Latency?

• Transmission Medium: The material/nature of the medium through which data or signal is to be transmitted affects the latency.
• Low Memory Space: The common memory space creates a problem for OS in maintaining the RAM needs.
• Propagation: The number of time signals take to transmit the data from one source to another.
• Multiple Routers: As I have discussed before that data travels a full traceroute means it travels from one router to another router which increases the latency, etc.

## How To Measure Latency?

Latency can be measured in the following ways.

• Time to First Byte: Whenever any connection is established, the time taken for the first byte of data from server to client is known as the Time to First Byte.
• Round Trip Time: It is basically the combined time in sending a request and receiving the response from the server.
• Ping Command: It basically does the same thing in that it determines the time required for the 32 bytes of data to reach its destination.

## Factors Other Than Latency that Determine Network Performance

• Bandwidth: Bandwidth is one of the important factors that determine network performance as it helps in measuring the data volume that can pass through a network for a given time. Bandwidth is measured in data units per second.
• Throughput: Throughput is also an important factor in determining network performance. Throughput basically refers to the data that passes through the network within a certain time.
• Jitter: Jitter can be described as the deviation in the time delay between the data transmission over the connection of the network.
• Packet Loss: Packet Loss is a factor in describing Network Latency as it measures the data packets that have never reached their final destination.

## Methods To Reduce Latency

To run the internet smoothly, you’ll need a network connection speed of at least 15mbps. Now, when it comes to bandwidth, if other members are playing online games, live streaming, or video calling, it will impact your performance, so you’ll need a lot of it to handle everything.

• HTTP/2: It reduces the time it takes for a signal to travel between the receiver and the sender by reducing the signal’s path or route.
• CDN: If you use a CDN, it will cache all of the data or resources near the user from around the world, allowing signals to retrieve data from nearby resources rather than going to the origin.
• Be close to your router: Signals flow wirelessly from one router to the next, but they can be interrupted or resisted by objects such as walls, furniture, and so on. Place your system in an area of your home with good connectivity.
• Upgrade Broadband Package: Sometimes the broadband connection provider is a problem, so if you find a better deal than the one you’re currently using, switch.
• Restart Your Router: If your router has been on for a long time, restart it to refresh it and relieve the constant strain on it.
• Close Background Running Application: If you’re using Amazon Prime, Netflix, Hotstar, YouTube, or live streaming, turn them off because they significantly slow down your system’s ping rate.
• Play Games On Local Server: To ensure good connectivity, always try to play online world games on your local servers.
• Use Ethernet Cable: Using a wired connection for internet connectivity is always a good option, but you will be the only one who can use the internet; others will be unable to do so. Actually, it’s beneficial because the signals have access to your system’s exact clear path through the wire, which means they don’t have to travel everywhere and encounter obstacles, reducing latency.

## How Can We Improve Network Latency Issues?

• Network Latency issues can be improved by upgrading network infrastructure.
• By regular monitoring of network performance, network latency issues can be improved.
• With the help of group network endpoints, we can improve network latency issues.
• Using traffic-shaping methods, network latency can be improved.
• By reducing network hops, we can reduce network latency issues.

## How To Fix Latency At Our End?

In some cases, latency can be due to the issue created on the user side. users may shift to a new bandwidth id he/she faces regular bandwidth issues. Users can switch to Ethernet from Wifi and it will result in a more consistent and reliable internet connection and helps in improving speed. Applying firmware updates regularly helps in making the connection to the Internet faster and overall provides better speed.

My Personal Notes arrow_drop_up