Packet Loss

Packet loss is the failure of some data packets to reach their designated destination across a network. Before transmission, data is segmented into smaller packets for efficient transport. These packets traverse various network components and infrastructures along their route, including the Internet Service Provider's (ISP) infrastructure, upstream ISP's infrastructure, internet exchanges, undersea internet infrastructure, and the recipient's infrastructure. It is along these points in the transmission path that some packets may fail to reach their destination.

Latency

Latency, in computer networks and client-server communication, is the delay experienced between the start of a request by a client and the receipt of the initial response from the server. This delay is usually measured in milliseconds (ms). Lower latency values are needed for optimal performance in various applications.

For applications such as online calls (audio/video) , online gaming, and real-time data extraction, having a low latency is very important as they are time-sensitive. These applications rely heavily on uninterrupted and responsive communication between the client and server as even slight delays can result in noticeable lag or disruptions.

Lower latency values signify faster response times and minimal delays in the transmission of data packets which enables faster, smoother and more efficient communication.

Jitter


Jitter means the variability in the arrival times of data packets transmitted over a network. In other words, it is a measure of the variation in latency experienced by packets while travelling through the network infrastructure. Ideally, packets should arrive at a consistent interval. However,owing to different factors such as network congestion, routing delays, or queuing at different intermediate nodes, packets may arrive at irregular intervals.

High jitter in a network can have adverse effects on real-time applications and services. For example, it can lead to poor audio and video call quality, as the inconsistent arrival of packets can result in disruptions, laggy playback, or dropped frames. Similarly, in online gaming environments, high jitter can cause increased ping times, resulting in lag and lowering the overall gaming experience.

DNS Server Response Time

DNS Server Response Time is the time it takes for a DNS server to respond to a user's request. For example, whenever we type a URL in the browser address bar, the URL is translated into an IP address which is then connected to by the browser. This works with the help of DNS wherein the browser will connect to a DNS server (whose IP address will be predefined in the network settings), and request for a given domain name's IP address. The time taken for the DNS server to provide the required data is measured as the DNS server response time, you could also call it DNS latency.

Faster DNS response times will make our web browsing experience faster and smoother.

Netprobe

How Netprobe can assist?

Netprobe can measure the packet loss, latency, jitter, and DNS response times and then visualise the collected data in a dashboard for human readability.

Netprobe can help identify issues that may be affecting our internet connection's performance, by identifying and fixing said issues we can ensure a more reliable internet connection for our daily activities like real-time data transmission, audio/video calls, gaming, etc.

Look below for an example of Netprobe in action.

Example Dashboard

Setting up Netprobe

Let's now set up Netprobe, here are some pointers for the setup.

  • I suggest you set this up on a separate computing equipment like a server or a computer that's always on.
  • There should be an Ethernet connection connecting the computing equipment to the internet router to avoid any WiFi-based issues.

Following the above steps should ensure accurate results and provide historical data for viewing long into the future. Also helps if you want to take up internet issues with your ISP and need some evidence to show.

Setup

Netprobe can be simply started using a docker-compose file. However, you can build it yourself and run it without docker, which may help get more accurate results as the docker network traffic has to go through the docker's network interface before reaching the actual network interface of the computer system. My tests did not differ, but it may vary for you.

  • Clone the git repository for Netprobe:
git clone https://github.com/plaintextpackets/netprobe_lite.git \
&& \
cd netprobe_lite
  • Now we'll perform some modifications to the .env file. Specifically, we'll change the anchor sites and DNS servers to be used. Have a look at a snippet of my .env file below.
# I've chosen the following sites to check connection latency
SITES="google.com,yarsa.org,stackoverflow.com,duckduckgo.com,reddit.com"

# I'm Using google.com for DNS test
DNS_TEST_SITE="google.com" # This is the site used in the DNS test

# I've used my Private DNS server as well to compare my local DNS server performance with third party ones.
DNS_NAMESERVER_4="My_DNS_Server" # Do not change this line at all!
DNS_NAMESERVER_4_IP="192.168.1.220" # Replace this IP with the DNS server you use at home

.env file snippet

  • Now let's pull the image for Netprobe from the docker registry. Use the command provided below.
docker compose -f compose.yaml pull

pull Netprobe docker images

  • Once we have the docker images, we can start Netprobe using the command below.
docker compose -f compose.yaml up -d

start Netprobe docker containers

Analysing the gathered data

Now that Netprobe has started and is gathering and analysing the data (it takes about 10 seconds after successful startup) we'll have a look at the data and figure out our internet connection quality.

example netprobe dashboard

As you can see the internet quality is 85.2% only which is not great. Let's have a look at the factors that have affected it.

  • First, with a packet loss value of 0.79% which is bad, it seems to have single-handedly tanked the score. The Packet loss value should always be closer to 0.
  • Second, the average time for the first response after a request is made to the 5 sites we decided on is okay-ish. In my internet connection the reddit.com website is slow but stackoverflow.com is extremely fast.
  • The average Jitter value is 3 ms and it is directly affected by the packet loss value so a decrease in packet loss will bring the jitter down.
  • Finally, DNS Response Time, the connection to my local DNS server has minimum latency which is to be expected considering it's on the same private network as the system Netprobe is on, there are minor fluctuations between Cloud Flare, Google and Quad9 but all in all the DNS Response time is good.

Conclusion

In this blog, we learned to set up Netprobe, monitored and visualized different factors that affected our internet quality score and now are well informed of the state of our network infrastructure.

Hope you had a fun time setting up netprobe and analysing the data. The codebase for netprobe is opensourced and you're free to extend it as you like.

Source Code of Netprobe:

GitHub - plaintextpackets/netprobe_lite: Simple internet performance tester written in Python
Simple internet performance tester written in Python - plaintextpackets/netprobe_lite