Wirebook › Bonus lesson
Why does the game lag when someone starts a download?
You're winning a game, and then someone in the house starts downloading a film. Suddenly your character jumps around and your shots land late, even though your internet is "fast". Why? Because your internet line works like a shop with one checkout, and a download is a shopper with endless trolleys.
What's really going on
- There's one checkout. Your line from the internet provider can only carry so much each second (its bandwidth). Everything in the house queues for it: the game, the film, the photo backup.
- The router keeps a waiting line. When parcels arrive faster than the line can carry them, the router lines them up in a buffer instead of throwing them away. A little queue is good: it smooths out bumps.
- Downloads fill whatever space there is. A download doesn't know how fast your line is. It keeps speeding up until a parcel goes missing, then slows down a bit and speeds up again. So it fills the queue right up to the end, every time.
- A huge queue means a long wait. Game updates are tiny, but they have to wait behind every trolley in front. 600 parcels at 1,000 a second is more than half a second of waiting, on top of the normal trip. Too much queue is called bufferbloat, and it shows up as lag and jitter.
- Speed and waiting are different things. The download still gets almost the whole line either way. A faster line makes the queue move quicker, but if the queue is enormous the game still waits.
Why routers don't just trust the label
- Labels are real. Every internet parcel has a small field where an app can ask for special treatment (grown-ups call it a DSCP mark). Video-call apps often set it.
- But anyone can write anything. A label is just a few bits the sender chooses. If a shop believed every label, a download could ask for the quick lane too and fill it up, so the label would stop meaning anything.
- So most of the internet ignores them. Providers usually wipe or ignore labels arriving from outside, and smart queues like fq_codel judge each conversation by what it does: one that only sends a little now and then goes first; one that keeps the queue full waits its turn and gets the early drops, whatever it claims.
- Careful routers that do read labels keep the quick lane small. CAKE's labelled mode, for example, only lets a lane go first up to a small share of the line, so a fake label can't take it over.
So how do you fix it at home?
Look in your router's settings for something called SQM, Smart Queue, Adaptive QoS, fq_codel or CAKE. Turn it on and set the download and upload limits to about 90% of the speed a speed test really measures. You give up a sliver of top speed and get a game that stays smooth while everyone else downloads. If your router has no such setting, the quick wins are to pause cloud photo backups while you play and to schedule big game updates for the middle of the night. To check, run a speed test that shows ping while downloading (sometimes called loaded latency): if it jumps by a lot, you've got bufferbloat.
Lag has a home-made half too, before anything leaves the house: the controller, the game's frames and the TV. Climb the lag ladder from thumb to TV. And past your front door, the pipe is shared with the whole street: see why the internet slows down in the evening.
Grown-up twin: Tooltern's help pages on fixing lag when someone downloads, what a good ping, jitter and packet loss look like and the Mbps to MB/s converter show the same ideas on a real network.