AKA: How I spent last week :).
On Tuesday Morning last week, I got an email from “email@example.com”:
You’ve probably already seen this article, but just in case I’d love to hear your response.
Playing Music Slows Vista Network Performance?
In fact, I’d not seen this until it was pointed out to me. It seemed surprising, so I went to talk to our perf people, and I ran some experiments on my own.
They didn’t know what was up, and I was unable to reproduce the failure on any of my systems, so I figured it was a false alarm (we get them regularly). It turns out that at the same time, the networking team had heard about the same problem and they WERE able to reproduce the problem. I also kept on digging and by lunchtime, I’d also generated a clean reproduction of the problem in my office.
At the same time, Adrian Kingsley-Hughes over at ZDNet Blogs picked up the issue and started writing about the issue.
By Friday, we’d pretty much figured out what was going on and why different groups were seeing different results – it turns out that the issue was highly dependent on your network topology and the amount of data you were pumping through your network adapter – the reason I hadn’t been able to reproduce it is that I only have a 100mbit Ethernet adapter in my office – you can get the problem to reproduce on 100mbit networks, but you’ve really got to work at it to make it visible. Some of the people working on the problem sent a private email to Adrian Kingsley-Hughes on Friday evening reporting the results of our investigation, and Mark Russinovich (a Technical Fellow, and all around insanely smart guy) wrote up a detailed post explaining what’s going on in insane detail which he posted this morning.
Essentially, the root of the problem is that for Vista, when you’re playing multimedia content, the system throttles incoming network packets to prevent them from overwhelming the multimedia rendering path – the system will only process 10,000 network frames per second (this is a hideously simplistic explanation, see Mark’s post for the details)
For 100mbit networks, this isn’t a problem – it’s pretty hard to get a 100mbit network to generate 10,000 frames in a second (you need to have a hefty CPU and send LOTS of tiny packets), but on a gigabit network, it’s really easy to hit the limit.
One of the comments that came up on Adrian’s blog was a comment from George Ou (another zdnet blogger):
“”The connection between media playback and networking is not immediately obvious. But as you know, the drivers involved in both activities run at extremely high priority. As a result, the network driver can cause media playback to degrade.”
I can’t believe we have to put up with this in the era of dual core and quad core computers. Slap the network driver on one CPU core and put the audio playback on another core and problem solved. But even single core CPUs are so fast that this shouldn’t ever be a problem even if audio playback gets priority over network-related CPU usage. It’s not like network-related CPU consumption uses more than 50% CPU on a modern dual-core processor even when throughput hits 500 mbps. There’s just no excuse for this.”
At some level, George is right – machines these days are really fast and they can do a lot. But George is missing one of the critical differences between multimedia processing and other processing.
Multimedia playback is fundamentally different from most of the day-to-day operations that occur on your computer. The core of the problem is that multimedia playback is inherently isochronous. For instance, in Vista, the audio engine runs with a periodicity of 10 milliseconds. That means that every 10 milliseconds, it MUST wake up and process the next set of audio samples, or the user will hear a “pop” or “stutter” in their audio playback. It doesn’t matter how fast your processor is, or how many CPU cores it has, the engine MUST wake up every 10 milliseconds, or you get a “glitch”.
For almost everything else in the system, if the system locked up for even as long as 50 milliseconds, you’d never notice it. But for multimedia content (especially for audio content), you absolutely will notice the problem. The core reason behind it has to do with the physics of sound, but whenever there’s a discontinuity in the audio stream, a high frequency transient is generated. The human ear is quite sensitive to these high frequency transients (they sound like “clicks” or “pops”).
Anything that stops the audio engine from getting to run every 10 milliseconds (like a flurry of high priority network interrupts) will be clearly perceptible. So it doesn’t matter how much horsepower your machine has, it’s about how many interrupts have to be processed.
We had a meeting the other day with the networking people where we demonstrated the magnitude of the problem – it was pretty dramatic, even on the top-of-the-line laptop. On a lower-end machine it’s even more dramatic. On some machines, heavy networking can turn video rendering to a slideshow.
Any car buffs will immediately want to shoot me for this analogy, because I’m sure it’s highly inaccurate (I am NOT a car person), but I think it works: You could almost think of this as an engine with a slip in the timing belt – you’re fine when you’re running the engine at low revs, because the slip doesn’t affect things enough to notice. But when you run the engine at high RPM, the slip becomes catastrophic – the engine requires that the timing be totally accurate, but because it isn’t, valves don’t open when they have to and the engine melts down.
Anyway, that’s a long winded discussion. The good news is that the right people are actively engaged on working to ensure that a fix is made available for the problem.