Friday, 17 May 2013

Network Streaming Comparison

WiFi vs. Gigabit vs. HomePlug for Streaming Media?

I have asked myself this question many times when trying to decide which networking medium is best to stream media from my server to my main media center. In my previous house, I used a simple 100 Mbps Ethernet connection to stream my media from my server to the media center. This worked perfectly for all my content including 1080p HD movies. However, since I have moved home, I have been struck by the problem of how to connect my server to my media center. This post attempts to provide a more formal analysis and benchmark of the various options.

I have used a good program called Lan Speed Test (Lite) to quickly and simply test the speed of each connection method. This is a simple program that times how long it takes to copy a file of specific size to another computer, and how long it takes to copy back. I decided that for now this test is adequate since I use SAMBA to share my media. I tried at least two different file sizes in each test and ran the tests several times each to iron out any random variations.

Ethernet

Like I mentioned above, I used to use a plain old 100 Mbps Ethernet connection. Since Gigabit has become highly affordable, I chose not to benchmark 100 Mbps performance as I know it works just fine. I chose to rather use the fastest medium I currently have available as a 'best case' scenario: 1000 Mbps Ethernet.

I performed the benchmark using a 20 meter length of CAT5e cable, connected from my laptop to the switch, which is connected directly to the server. The results can be seen below:

Gigabit Ethernet: ~20 MB File
Gigabit Ethernet: ~200 MB File
As you can see, without any special optimizations, the fastest speed I can copy a relatively large file from the server over my Ethernet connection is about 450 Mbps. Obviously this is more than fast enough for streaming media. Noticably, copying a larger file results in better performance. This is a good thing because media such as video tends to be on the large side.

At the time I had XBMC 11.0 set up on the media center, using a remote MySQL database for the library and the response times for loading up library lists and information is very good. When a movie is selected, it starts with no noticeable delay (a second or two).

Although the speed of Gigabit is essentially ideal, I do not use it because I have no way to neatly and easily route the cable from my server without cutting into walls, etc. Because of this problem, I have been forced to test other options.

WiFi

WiFi is the next logical option to use for streaming to a media center. I purchased a cheap WiFi access point (Tenda 2.4 GHz 300 Mbps ceiling mount: W301A) and mounted it on the ceiling near my server. (I plan on writing a full review on this access point in the near future.) The distance to the media center (and laptop for the test) is about 5 meters, but there is a door to the side and a brick wall in-between. 

I have limited the WiFi mode to 150 Mbps n (20 MHz) mode to avoid using up too much bandwidth. The laptop connects with fairly strong signal at 144 Mbps.

144 Mbps WiFi: ~20 MB File
144 Mbps WiFi: ~200 MB File
Predictably, the bigger file has the fastest download speed of the two tests. In actual usage tests, I was able to play any 1080p HD content (files up to ~17 GB) without dropped frames. I did however encounter some problems. Sometimes in the evenings the system would be slow to load the library, and media would buffer before playback and even (irritatingly) stop randomly to buffer. This indicated a typical problem with the network connection, brought about by the increase in wireless network activity when all my neighbors were home, surfing the internet and what not!

I did a wireless scan around the house, and predictably there are many WiFi networks in range. There were a few networks that were visible from the AP's perspective and not from the media center's and also a few networks that had strong signals on the same channel as my network. There were no channels for me to switch to that would provide any less noise. This will be a similar situation for many people who live in close quarters to their neighbors. It doesn't help the situation that most AP's are by default set to their highest transmit power and most people don't think to turn it down to only what is necessary... There are some good articles on Wikipedia about these sort of problems which I would recommend reading: Hidden node problem and 2.4 GHz Interference.

I was not totally happy with having to wait for movies to buffer at random points, usually in a high bit-rate action scenes, so I had two obvious alternatives: 5 GHz WiFi and power line networking (or more commonly HomePlug). I had a look at 5 GHz routers and AP's, but I have a future project in mind so I decided to give HopePlug a test.

HomePlug

I invested in two cheap 200 Mbps HomePlug devices (Tenda P200) on the off chance that they would work well for me. I have read a few reviews and performance (throughput) seems to be a little lacking in most cases, but the distance between the plug behind my server and the plug near the media center is not huge so I took a chance!

In a nutshell, HomePlug AV is a standard where a normal Ethernet connection is encrypted, modulated with OFDM on a high frequency carrier (several MHz), along with some forward error correction (FEC), and 'superimposed' onto the normal mains wires (see Wikipedia). In theory, any other HomePlug device should be able to detect this additional voltage on the mains wires and decode the signals back to normal Ethernet.

The reason why power line networking is sometimes slow, or doesn't work altogether is simply due to the fact that there are many different devices connected to the mains in your home, each of which can absorb some of the signal, overpower it with random noise and sometimes the electrical circuits are totally separate too (via the DB board)!

I tested the throughput from two different locations in my house. The first location is from the server to my study (where my desktop PC lives), and the second is from the server to the media center.

HomePlug (Server - Study): ~20 MB File
HomePlug (Server - Study): ~200 MB File
The results from the server to the study are rather disappointing. This speed is essentially unusable for streaming large media such as a 1080p HD movie, although streaming smaller files (up to a few GB) still seems to work.

HomePlug (Server - Media Center): ~20 MB File
HomePlug (Server - Media Center): ~200 MB File
Strangely, although physically the distance between the server and the media center in my lounge is further, the performance is better. This must be due to strange internal wiring - perhaps the wires between the plugs in the lounge and server are more direct that between the server and study. Stranger things have happened with household wiring...

The performance of the server to lounge connection, although relatively slow compared to WiFi or Ethernet, is adequate for me to successfully stream any of my media and run the XBMC based media center without any hitches.

Conclusion

All the above network types have advantages and disadvantages:
  • Ethernet is very fast and reliable, but it requires a dedicated cable which can be difficult to install (and look good). 
  • WiFi is easy to set up and is quite fast (especially if 802.11n is used), but it suffers from signal interference and degradation over distance and through obstacles such as walls. One can use 5 GHz WiFi to beat the issue of interference (for now), but degradation over distance will be more severe and equipment is not as common and costs more.
  • HomePlug is easy to install and is easy to hide with no wires, etc. and it is cheap depending on the brand of device. Throughput can be very slow, making it useless, but in cases it can also be perfectly adequate! Interference from neighbors is essentially zero.

The Last Word

I now use the HomePlug device for my media center connection to the server with a backup WiFi connection. I have yet to encounter a problem streaming over the HomePlug. As strange as it may sound, I find it more reliable than the WiFi connection because of its relative isolation. Problems with WiFi will decrease if it is being used in a stand alone house or an area with fewer active WiFi connections, in which case it is faster and hence better. Migrating to 5 GHz WiFi is a viable alternative as well, but is still quite expensive in comparison to my cheap HomePlug setup.

I hope this quick and non-exhaustive comparison was useful to those considering what options are available to them!