What is lag?

Posted by CTO of Netduma
28 May

Introduction

In this article we address and describe the root causes of lag. We have cited papers to backup claims.

How do online games work?

To understand lag you must first understand how online games work. When you play online games typically all the players connect to the host like so:

Figure 1. Gaming star topology.

Figure 1. Gaming star topology.

Each player has a copy of the virtual world and they communicate with the host to try synchronize the worlds.

This gives all of the players the perception that they are in the same virtual world as each other.

When a player performs an action, they send a packet of information to the Host (shown in Figure 2). This will typically contain information like the player’s orientation, velocity and actions like gun shots. This is why games use such little bandwidth, typically way less than 0.3mbits.

Figure 2. Send action to the host

Figure 2. Send action to the host

Once the information reaches the server it must apply it to the game world and distribute that information to all the other players:

Fig 3. Distribute action to all other players

Fig 3. Distribute action to all other players

A problem arises because the packets take time to reach the host.

This is commonly called ‘ping’ (technical sidenote: ping is actually the time it takes for a packet to go to the host and return).

So imagine a scenario where player A has a good ping of 25ms but player B has an awful ping of 150ms.  Then these sequence of events occur:

  • Player A is in the open and realizes it’s a bad idea so he runs for nearby cover
  • Player B has not received the update that Player A has gone behind cover so shoots at Player A

So now the host has a paradox. Player B says he shot player A, but Player A says he’s behind cover. What does the host do?

Well it’s literally a paradox and there is no right answer. So the game has to make a tough decision on who wins in that scenario. The manifestation of this paradox is what we call ‘lag’.

BUT remember the root cause of this problem is the delay that packets encounter when being transferred back and forth between the player and the host.

So the questions is what causes this delay?

Network Delay

The Internet is a network of computer networks, hence the word ‘Internet’.

So delays occur from network delays. This has been common knowledge since the birth of computer networks (packet-switched networks).

Specifically there are 4 causes:

  1. Processing delay – time it takes for a router to forward a packet
  2. Queuing delay – time packets spend in queues
  3. Transmission delay – time it takes to push bits onto the link
  4. Propagation delay – time for a signal to be transferred across the link

With modern routers & broadband technology, number 1. Processing delay and 3. Transmission delay are sub millisecond and are not worth considering on the Internet where pings often range between 10 – 1000+ ms.

So let’s address 2. Queuing delay first.

Queues occur when you go from a high speed link to a low speed link.  So if you have a 100mbit link connected to a 10mbit link, 10 packets can arrive in the time one can get sent. Instead of dropping the packets they get put in a queue. The time spent in this queue can add huge delays.

But where do these queues occur on the Internet? Well it turns out that the core of the Internet is over-provisioned. This means it has higher bandwidth than its input so there is essentially no bottleneck and therefore no queuing [1][2].

“Core network links are over-provisioned, experience essentially no queuing” [2]

So the queuing occurs at the ‘access networks’, in other words, your home. The queues there can cause significant lag ranging from 150ms to 2000ms depending on your ISP [3].

“Our findings show diverse queue configurations for broadband links, with most hosts exhibiting queue lengths significantly higher than 130 ms” [3]

Queuing lag occurs either at your home or the home of the host you’re connecting to.  To put it in simple terms, if someone is downloading or uploading excessively in your home, your packets will be forced into a queue, resulting in lag.

This is where the primary advantage of a dedicated server comes from. The person or company hosting the dedicated server should provide ample bandwidth for their servers so there won’t be any queuing at their end.

This leaves you with one other cause of delay; 4. Propagation delay.

This means the time it takes to transmit the packet over the link. Unsurprisingly the further the distance, the greater the delay [4][5][6].

“we find a strong linear association between RTT and geolocation distance” [4]

The graph below [5] illustrates how the further away you are from the host, the worse the delay and therefore the greater the lag.  This makes sense because as with real life, the packet actually has to physically travel and the further you have to travel, the longer your trip will be. You will experience this delay when the host of your game is in a foreign country far away from you, or East Coast US vs West Coast US.

Figure 4. Illustration of round trip times(ping) rising with distance [5].

Figure 4. Illustration of round trip times(ping) rising with distance [5].

Conclusion

So lag is essentially the manifestation of Internet packet delays of which there are 3 primary causes (illustrated on Figure 5):

  1. Local queuing that occurs at your home and your ISPs routers
  2. The total distance the packet has to travel
  3. Remote queuing that occurs at the home and ISP of the host

 

Figure 5. The 3 points of Internet delay. 1) Local access network queuing. 2) Delay caused by distance between hosts. and 3) Remote access network queuing

Figure 5. The 3 points of Internet delay. 1) Local access network queuing. 2) Delay caused by distance between hosts. and 3) Remote access network queuing

The Netduma R1 router is unique in that it addresses all 3 causes of lag.

1. The Congestion Control section of the router makes sure that the total bandwidth you use is always slightly less than the available bandwidth so that there is no bottleneck and therefore no local queuing solving delay point 1.

People often then ask ‘will this impact the non-gamers in a detrimental manner?’.

The answer is no, because computers are designed to exponentially probe for bandwidth so they always over transmit (see TCP slow start algorithm).

Just a slight reduction will stop the queuing and will make a tiny difference on the speed. For example if it took you 2mins to download a file, it may take 2mins and a second now. So the user won’t even really notice it BUT the gamer will see a huge difference as queues are eradicated.

Our Congestion Control uses algorithms unique to Netduma (not the typical broken QoS) that work in both download & upload direction. We have received very positive feedback from customers about it.

2. To address the distance problem, you unfortunately can’t make packets transmit faster because they are already travelling near the universe’s speed limit: the speed of light. So instead we implemented the Geo-Filter which lets you limit the maximum distance the host can be from you. This will significantly lower your ping.

3.Even if you connect to someone near you, they may still have local congestion so the delay will still be significant. Our solution is simple, just block them using our Deny & Allow feature. You won’t have to play on their host again.

So in conclusion with correct use of the Netduma R1 features you can minimize the delay and therefore lag.

We will write a blog in future about the difference of our congestion control.

References

[1] Beheshti, Neda, et al. “Optical packet buffers for backbone Internet routers.”IEEE/ACM Transactions on Networking (TON) 18.5 (2010): 1599-1609.

[2] Vu-Brugier, G., et al. “A critique of recently proposed buffer-sizing strategies.”ACM SIGCOMM Computer Communication Review 37.1 (2007): 43-48.

[3] Dischinger, Marcel, et al. “Characterizing residential broadband networks.”Internet Measurement Comference. 2007.

[4] Landa, Raúl, et al. “The large-scale geography of Internet round trip times.”Networking. 2013.

[5] Agarwal, Sharad, and Jacob R. Lorch. “Matchmaking for online games and other latency-sensitive P2P systems.” ACM SIGCOMM Computer Communication Review. Vol. 39. No. 4. ACM, 2009.

[6] Canadi, Igor, Paul Barford, and Joel Sommers. “Revisiting broadband performance.” Proceedings of the 2012 ACM conference on Internet measurement conference. ACM, 2012.