Testing Mac OS X audio playback during heavy network load.
A ZDnet blogger asks whether Apple's Mac OS X throttles network bandwidth during multimedia playback. I create and execute an experiment in an attempt to answer his question.
A lot has been made of recent problems detected in Microsoft's Windows Vista, whereby network traffic is capped during multimedia playback (original thread/detailed explanation). As the issue became widely reported online, ZDnet blogger Adrian Kingsley-Hughes asked "What happens to network performance on Linux/Mac when you play audio?".
Now in the discussion attached to Mr. Kingsley-Hughes, a number of users attempted their own brief tests of OS X and Linux systems, to see if they showed any artificial network capping, or any issues with audio playback (as Microsoft claims that the artificial cap is in order to ensure real-time multimedia playback). Mr. Kingsley-Hughes fellow ZDnet blogger, George Ou (well known in several communities for his extreme pro-Microsoft bias) noted that the issue only presents itself at network speeds of over 100Mbps, and thus that many of the users who provided tests on a typical 100Mbps home LAN. One user (identified as "frgough") who did attempt a test at gigabit speeds was quickly shouted down by Mr. Ou as a cry-baby (not a very professional thing to say to a reader, I must say) when the user defended his testing against Mr. Ou's implied claim that something was wrong with the readers conclusion that the Mac doesn't exhibit this documented Windows Vista issue, because (in part) that user only got a sustained transfer rate of about 25Mbps, versus the 60Mbps Mr. Ou claims he can get in Vista. While Mr. Ou doesn't provide any details as to his test rig or or testing approach to achieve this number, however frgough does point out that his testing was done between two Apple laptops, running slower laptop drives, and that the sustained transfer rate of the drives was what was limiting the speed of the transfer.
I'll let others deal with how Linux performs in this scenario (while I do have several Linux boxes, none of them have gigabit ethernet adapters). However, as I am a Computer Scientist with access to a pair of Apple Macintosh systems with Gigabit ethernet capabilities, I decided to do my own testing of the situation, in a purely scientific manner. Thus, I present here the full experiment, complete instructions for duplicating it yourself, along with my results. I come into this with no assumptions as to the results, and will not provide any Vista comparison myself (as my only access to Vista is as a virtual machine running within Mac OS X). Others have already provided a lot of testing on Vista -- my only interest is in answering Mr. Kingsley-Hughes question: "What happens to network performance on Mac when you play audio?".
Question: "What happens to network performance on Linux/Mac when you play audio?"
Experiment Equipment:
- - White MacBook (2.16Ghz Core 2 Duo, 2GB RAM, 160GB HDD)
- - PowerMac G5 (2.4Ghz dual G5 SMP, 2GB RAM, 400GB HDD)
- - Cat 5e cable
Experiment Configuration:
With both systems powered on, I disconnected the PowerMac from it's wired network connection. I disconnected both the PowerMac and the MacBook from the wireless network by turning the wireless subsystem off on both systems. The MacBook was connected to a power supply, and both systems were set for "Normal" performance. The PowerMac had Internet Sharing enabled (System Preferences -> Sharing -> Internet). The two machines were directly connected to each other through their Gigabit Ethernet adapters via a straight-through Cat 5e cable. The link speed was verified on both systems through Apple's "Network Utility" as 1Gbps.
In order to remove the drive speed from the equation (as the key here is to saturate the network in one direction to produce the highest network traffic possible), both systems had half-gigabyte RAM disks created for the data transfer. These were created within Terminal.app, using the following command:
hdid -nomount ram://1048576
(Note that the ram:// parameter to hdid specifies the number of half kilobyte sectors to be created, thus 1 048 576 sectors is 512MB).
From within Apple's Disk Utility, both RAM disks were partitioned with a single partition (using Apple Partition Map, with OS 9 disk drivers disabled), and formatted as "Mac OS Extended" (i.e.: not journaled). On the PowerMac, this partition was labelled TestA, and on the MacBook is was labelled TestB.
Once the partitioning was completed on both systems, a large random file was created on the MacBook's RAM disk, using the following command:
dd if=/dev/random bs=512 count=1048400 of=/Volumes/TestB/500mb.file
(The resulting data file is just shy of 512MB -- this was done to ensure suitable space on the formatted volume due to space used by file system structures).
The PowerMac then had its firewall disabled, and FTP server enabled (both from the "System Preferences -> Sharing" panel). On the MacBook, within Terminal.app, the current directory was changed to /Volumes/TestB, and the command line FTP client was run:
ftp 192.168.2.1
After authenticating, the following FTP commands were then executed:
cd /Volumes/TestA
put 500mb.file
The put command was executed a total of six times: three while no multimedia playback was occurring, and three with multimedia playback. For the playback, the song Vincent by Don McLean (iTunes Plus edition, 256kbps, 44.1khz, AAC. I can't find it in the iTunes Plus Canadian store anymore, but here's the link to the standard iTunes version) was played in the background, via the laptops built-in speakers, initiated prior to the fourth put command, and stopped after the sixth.
Results of the FTP session were recorded, and partial screen captures of the Apple Activity Monitor's Network data monitor were recorded for each of the six transfers.
Results:
The results below for each test contain two elements: the output from the FTP client, and the screen capture of the network activity from the Activity Monitor. Note that the transfer speeds reported by each are not expected to match -- the FTP client reports the average speed on the file transfer socket, whereas the Activity Monitor capture shows the peak transfer rate during the displayed interval.
No music playing:
ftp> put 500mb.file
local: 500mb.file remote: 500mb.file
229 Entering Extended Passive Mode (|||53715|)
150 Opening BINARY mode data connection for '500mb.file'.
100% |*************************************| 503 MB 42.20 MB/s 00:11
226 Transfer complete.
528424960 bytes sent in 00:11 (42.17 MB/s)
ftp> put 500mb.file
local: 500mb.file remote: 500mb.file
229 Entering Extended Passive Mode (|||53719|)
150 Opening BINARY mode data connection for '500mb.file'.
100% |*************************************| 503 MB 45.23 MB/s 00:11
226 Transfer complete.
528424960 bytes sent in 00:11 (45.20 MB/s)
ftp> put 500mb.file
local: 500mb.file remote: 500mb.file
229 Entering Extended Passive Mode (|||53721|)
150 Opening BINARY mode data connection for '500mb.file'.
100% |*************************************| 503 MB 46.14 MB/s 00:10
226 Transfer complete.
528424960 bytes sent in 00:10 (46.11 MB/s)
Music Playing:
ftp> put 500mb.file
local: 500mb.file remote: 500mb.file
229 Entering Extended Passive Mode (|||53722|)
150 Opening BINARY mode data connection for '500mb.file'.
100% |*************************************| 503 MB 41.24 MB/s 00:12
226 Transfer complete.
528424960 bytes sent in 00:12 (41.21 MB/s)
ftp> put 500mb.file
local: 500mb.file remote: 500mb.file
229 Entering Extended Passive Mode (|||53723|)
150 Opening BINARY mode data connection for '500mb.file'.
100% |*************************************| 503 MB 41.24 MB/s 00:12
226 Transfer complete.
528424960 bytes sent in 00:12 (41.21 MB/s)
ftp> put 500mb.file
local: 500mb.file remote: 500mb.file
229 Entering Extended Passive Mode (|||53724|)
150 Opening BINARY mode data connection for '500mb.file'.
100% |*************************************| 503 MB 45.61 MB/s 00:11
226 Transfer complete.
528424960 bytes sent in 00:11 (45.58 MB/s)
Analysis of Results:
With no audio playing, the average transfer rate for the three FTP sessions was 44.5Mbps. The average peak transfer rate during the no-music tests was 47.5Mbps.
With audio playing, the average transfer rate for the three FTP sessions was 42.7Mbps. The average peak transfer rate during the with-music tests was 46.4Mbps.
The difference between the average transfer rates between the two sessions was about 4.2%. The difference in peak transfer rate was only 2.3%. In both cases, the difference was fairly negligible.
In all three of the music cases, there was no recorded or perceived loss of real-time reaction for the music playback.
Conclusions
The experimental results could be further refined using a larger test file and significantly more test points. While the with-music testing does show an average decrease, the highest peak transfer rate with music is higher than the lowest peak transfer rate without music, and as such we can deduce that there are insufficient data points to declare these values as being statistically reliable. However, the preponderance of evidence does seem to indicate that music playback appears to have no impact whatsoever on network transfer rates on Mac OS X, answering Mr. Kingsley-Hughes original question.
As to the test results showing a network transfer rate about 50% slower than Mr. Ou's claimed results under Vista, the average rate achieved in my testing was just shy of 350Mbps, significantly over the 120Mbps where the Vista network throttling is reported to kick in at (and thus also well over Mr. Ou's request for testing at speeds of over 100Mbps), thus providing a valid test for the existence of any network throttling code related to multimedia in OS X (of which there appears to be none).
Posted: Thursday - August 30, 2007 at 03:01 PM