Latency, in general terms, is the time delay in accomplishing a specific task. Network latency rate, thus, is the delay in a network or over the internet. For example, delay in the opening a webpage, or delay in getting a result from a click. High latency is detrimental to the website and can cause lag.
In a communication network, there are two variations of latency:
- One way latency: It is the time delay in delivering a packet of data from source to destination. It includes data processing time in the destination.
- Round trip latency (RTT): The time delay in delivering data from source to destination and again from destination to the source. Ping measures the round trip latency. Data processing time is not included in RTT.
Latency vs Bandwidth vs Throughput
Let us understand each term in detail.
- Latency: It is the time delay in a network.
- Bandwidth: It is the measurement of maximum data that can travel through the network in a given amount of time. It does not measure the network speed, only the data transfer rate, which is directly proportional to bandwidth.
- Throughput: It is the measurement of average data that can pass through the network in a given amount of time. Unlike bandwidth, throughput is affected by latency.
Also read: How to use Ping command to test your internet network
Factors affecting latency
High latency causes lag and thus can cause the visitor to leave the website, thereby, affecting business. High latency can also change the user experience in gaming. Perfect data transfer (where the latency is 0) is impossible to achieve. Let us understand the factors that cause lag.
Medium of transmission
There are several mediums of data transfer, such as optical fibre, wireless, among others. Every medium has its limitations that cause the delay. The fastest among them is the optical fibre which transfers data in the form of light pulses (photons). Even the optical fibre has limitations. The data travels at 30% of the light speed. Along with that, several repeaters and cables slow the data speed.
Size of the data packet
Large data packets require more time to process and thus increase latency.
Storage delays
Data is stored on hard disks or other storage mediums. The delay occurs in the intermediate level, such as switches and bridges, while accessing the data from the location and then transmitting it across the networks.
Propagation
It is the time delay that occurs when transmitting the data from one point to another at the speed of light.
Anti-virus software and other security features
The anti-virus looks for certain malware present and can involve complete teardown and then reassembling of the data, thus causing the delay.
Problems in software
Software malfunction can cause data to take time in loading. This is from the user’s side, and updating or changing the software usually resolves the issue.
How to reduce latency
Reducing latency is desirable as it increases the web traffic on the website by loading it faster. Moreover, less latency is highly beneficial to gamers where even a slight lag causes the gaming problems. A user can reduce the latency by following ways:
Use of Content Delivery Network (CDN)
The content delivery network is the network of servers that are placed strategically to provide a seamless transfer of data across the globe. CDN caches the static as well as dynamic content to the servers causing less time delay in loading of websites. As they are located in multiple geographical locations, they ensure that the data is transferred quickly.
Use of HTTP/2
It is the second update to the HTTP protocol. HTTP/2 aims to make the website resources load faster. HTTP/2 has the following features which reduce latency:
- It is binary and not textual.
- It is multiplexed, that is, can send multiple data requests parallelly on a single TCP connection.
- HTTP/2 uses header compression, which reduces overhead.
- Instead of waiting for a new request for each resource, it allows the servers to push responses into client caches.
Use of various Prefetching Methods
Prefetching is a way that makes the website load faster. This does not reduce the latency; however, it makes loading faster. A user can configure the webpage so that the necessary functions are loaded first and the interaction can begin before the full loading is done. A browser caches the link, a domain name server or can prerender the resources required to load the page. With prefetching, the processes requiring high latency, such as DNS lookups, are done in the background.
Optimising the website
A user can optimise the website by reducing the size of the images or by using a method known as lazy loading. Lazy loading loads the assets only when they are needed. Similarly, resizing the image make them load faster. Also, the theme of the website should be simple so that loading is faster. Again, these methods do not directly affect latency but can improve user experience.
Use of right hardware and internet connection
The user can purchase more bandwidth or can upgrade the existing server plan. Also, the user can try to switch on Ethernet onstead than WiFi. Ethernet provides a more seamless and consistent internet connection. Along with that, the user should keep the hardware up to date by replacing them wherever necessary.
Other methods to reduce latency are overclocking the hardware, minimising the number of render-blocking resources, and using less third-party servers, which will increase website latency.
Also read: Peripherals, Accessories and Networks: Wired vs Wireless