I am a gamer. I am also a developer. And games are just software. When something goes wrong in-game, instead of lashing out in anger like every other gamer you see online, the programmer in me wonders what broke and why. Could it be software-related? Could it be hardware-related? Could it be networking-related? This time, I'm looking into network latency and why I'm getting "spikes" while gaming over WiFi.
ping all the things
When latency is concerned, everyone grabs
ping - a built-in system utility that, as the name suggests, "pings" other machines and prints out the network details like arrival, round-trip time, packet loss, etc. Everyone recommends pinging a fast remote server like Google's
184.108.40.206 to check latency. However, there's a lot of hardware between the remote server and my machine. So before blaming the ISP, the game server, and everyone else, it's wise to check the local hardware first. And so...
ping the router
I pinged the router. Latency can occur locally, especially when hardware is obscured, when the signal is interfered, when the router is overwhelmed, or when bandwidth is starved. And to my surprise, I'm getting the spikes that coincide with the remote spikes. It's entirely possible that the local spikes are causing the remote spikes, just amplified by the round trip. Now that I've pinpointed the source, it's time to do some Google-fu and resolve this issue.
Move to 5Ghz
Now the first thing people point out is signal interference. Interference causes packet loss, which causes retransmission, which is unnecessary delay. Add to that the other things that operate at the 2.4Ghz range like microwave ovens, Bluetooth devices, and even your RF mouse and keyboard. So for the devices that could, I moved them to 5Ghz. Also, I had to isolate the devices in 5GHz via router access controls, since most 5GHz devices are dual-band and will switch back to 2.4GHz if it finds it stronger, especially at range. While it did improve average latency, it didn't really solve the spikes.
Disabling Windows Delivery Optimization
Then I noticed that the spikes would happen at regular intervals which indicate artificial causes.
ping would report a stable 3-9ms and then suddenly it would jump to 15-30ms at 10-15 second intervals. A quick Google search revealed that Windows Delivery Optimization was the cause. This feature allows Windows to, instead of downloading from Microsoft servers, download updates from other Windows machines in a p2p manner over Windows machines on LAN or over the internet. Disabling it eliminated the 10-second spikes. Not exactly sure how this works or why it causes spikes, but it worked and that's all that mattered.
The last mystery are the spikes that occur 45 to 60 seconds apart. It took me a while to figure this one out. While sitting in front of the TV writing this post, I decided to do a
ping. The spikes were non-existent. However, when I streamed YouTube to the TV via Chromecast, the spikes reappeared. Then I realized that the spikes were caused by video buffering. And it's especially stronger when Chromecast streams at 1080p than 720p, for obvious reasons. There's little I can do about this though, since everyone at home streams videos in some form.
To summarize, here's what you can do to improve your WiFi gaming experience:
Look closely at your latency and don't blindly blame anything.
Don't cheap out on your router. Get a router that supports wireless AC.
Check your router's processor. Slow processors will choke under load.
Move to an uncongested WiFi channel, or switch to 5GHz if possible.
Turn off anything unnecessary that could hog the network.
Isolate your device from everyone else's, like a separate network or AP.
WiFi is generally 4MBps (N) to 9MBps (AC). Keep everyone's use in check.
"Get better hardware and be the only one on WiFi" pretty much sums it up.
Gaming over WiFi isn't as good as wired, and that's a fact. But it isn't that bad either. If you simply know how WiFi works, what things can potentially degrade its performance, and how to troubleshoot and mitigate connectivity issues, gaming over WiFi won't be as painful as everyone describes.