Steam in-home streaming is great. I can play graphics/CPU intensive games on my laptop sitting on my couch. Or I can let the (Windows) laptop run Spelunky while playing at my linux desktop. But I had a problems with it: I kept getting intermittent lagging. A little notice would pop up in the bottom left corner informing me of slow network speeds. Both machines are on wifi for network and so I thought putting the laptop on ethernet would solve the issue. Halving the strain on the air waves should do the trick but it made no difference. Which meant that the problem was likely to be on the linux desktop and it’s wireless connection.
Now, the most characteristic thing about the lags was the regularity with which they occured. I didn’t measure them but I started thinking to myself, “It’s gonna come any minute now…” About every two minutes for ten seconds or so. More than enough to get yourself good and killed in Spelunky. I tried network monitoring to see if I could catch whatever process was stealing Steam’s bandwidth but with no luck.
The reason for this is that it wasn’t a process hogging bandwith per se, it was NetworkManager scanning for networks. This happens at some specific interval and tends to cause a drop in bandwidth, something that is most noticeable in live streaming.
Bizarrely, this function is not an option but apparently hardcoded. Or it was in 2009 and nobody has seen fit to say otherwise since. Seeing as I’m at a desktop computer, I really don’t need for NetworkManager to be looking for any other networks than the one it’s on. I suspect most people on laptops don’t have any need of it either, once they’re connected. According to Dan Williams, the developer of NetworkManager, you need background scanning, that is scanning for networks even though you’ve already got a connection, because of a) roaming and b) location-based services.
I look at my 7kg desktop computer, reliant on a wifi connection because it just happens to be on the wrong floor. I’m sorry, old pal, I whisper, But you’re not roaming anywhere. You’re Dunroamin. Except of course, you never actually roamed. Or needed to know about pizza parlors nearby. Because I friggin’ live here and I know where there’s pizza.
Also you can’t have an on-off toggle just because you don’t need background scanning (or would rather do without it) because
Only have one AP at your place and don’t need roaming? That’s nice, but writing software is about making things work smoothly for everybody. Which is what background scanning is all about.
Insisting that one size fits all despite evidence to the contrary is “making things work smoothly for everybody”? Yeah. Huh. Oh well.
The good news is that we don’t really need NetworkManager once it has made a connection. Stopping NetworkManager will cause the GNOME network interface (the wifi/ethernet icon and widget in the upper right corner) to disappear
but the connection that has been made by NetworkManager will persist (altough probably not reconnect should the connection be interrupted). As of November 2015 this appears to no longer be the case: Stopping NetworkManager will kill your connection, as it seems NetworkManager takes dhclient out with it. I have yet to find a way to avoid this. The instructions below are therefore most likely useless. In May of 2017 I went ahead and replaced NetworkManager with systemd-networkd. You can read a walkthrough of that here.
So we can simply tell Startup/SystemD/insert-init-of-choice to stop the service.
sudo stop network-manager
sudo systemctl stop NetworkManager
Or yes, you can find a more minimalistic network application or even connect manually/by script. I may need to look into that once the full significance of being able to play Spelunky on linux hits home.
Finally, I just want address another of Dan Williams’ 2009 gold nuggets:
Oh, bought a Ralink card or a Broadcom? Sorry, better luck next time. This is why you buy hardware that actually works with Linux, so that the Gods of Kernel Wireless will rock your card, and you won’t be stuck with dead-end shit that never gets better.
I recently bought a new RAlink USB wifi dongle and it’s frankly ridiculously hard to pin down what chip any one product has, as the same exact product name can change chip producer from one version to the next. These version numbers are not announced on almost all web shops’ product pages. I spent half a day researching and felt bad once for sending a guy on phone support all the way down to find the physical product and read the version number to me, only to tell him that it was the wrong one. At any rate my nonscientific survey indicated that Ralink and Broadcom chips seemed to have replaced Atheros chips in a lot of products, so it’s not exactly as simple as all that. When I bought my dongle I had to settle for a Ralink product and call it a success, as at least it wasn’t the hated Broadcom of my previous device. So thanks, Dan. You’re a great help.