Sure, you love Netflix and Spotify. Sure, right now maybe you are, like us, listening to your favorite tracks using the desktop client of Spotify or maybe you are planning to stream a movie from Netflix later on with your new crush. Whatever the case, have you ever wondered how Netflix or Spotify actually work? While you stream Dave Matthews Band or stream House of Cards, have you ever wondered about the Cloud technologies behind your entertainment and how they work?
Well, if you’re like us, you have. As such, sit back, find your favorite jam and learn how streaming music from any location in the world works.
P2P Networks and Local Cache, Not Cloud
Did you know that Spotify, unlike Pandora or Grooveshark, is the only non-web based music streaming service? Did you know, much like the Napster of old, Spotify is actually one large P2P network with a backend of scalable Cloud based servers? Well, it is. Spotify leverages P2P networks to scale their servers when demand and increased load happen.
Interestingly enough, the reason you can stream your favorite music on demand is not because it comes directly from a Cloud hosting solution. Rather, only a mere 8.8% of all Spotify jams are streamed directly from the companies home servers. The other 91.2% streams directly from P2P networks (35.8%) and your local cache (55.4%).
It should be mentioned, while desktops and Mac’s fit into the above statistics, the same numbers do not hold true for Spotify mobile users. For those Spotify users who stream their content through their smartphones or tablets, roughly all of that content is being streamed using the companies’ elastic Cloud servers.
Local Cache and Overall Cloud Storage
To keep network load down, the majority of streamed content comes from a user’s local cache. By Spotify’s own admission, most of their user base has a large local cache. Of that user base, 56% maintain the maximum cache size of 5GB or more. For the network, the local cache means network traffic stays at a minimum thus allowing for instant stream with no degradation in service.
When it comes to the business end, to keep streaming smooth and clean, Spotify maintains three massive storage farms with more than 470TB of storage available. In their main storage location, Spotify maintains a 290TB threshold. In their other two storage data centers (London and Stockholm), the company maintains 90TB of storage in each location respectively.
How it Works
All this stated, the following process is how you stream the music your listening to right now.
- A user selects the song he/she wants to listen to
- If locally cached, the song plays from that location
- If not locally cached, the song begins playing from Spotify servers. Within 15 seconds of start, playback sets in
- While this is happening, Spotify searches for the currently playing song on the overall P2P network.
- As the song plays through, it is streamed from the aforementioned combination of sources (Spotify servers, P2P, local cache).
- As the song begins to end, Spotify searches the P2P network for the next song to play. If that song isn’t found on the P2P network within 10 seconds of the start of the next song, the jam steams from Spotify servers.
- The process repeats.
As you would imagine, along the way there are going to be set backs, lags in streaming content and buffering. To deal with the inevitable lag of content, Spotify has installed fail safe measures to limit new content uploads to the P2P network.
So, does your favorite jam on Spotify come directly from the Cloud? Maybe. However to keep the network clean, more often than not your tunes are local and thus, instant.
Now, if you’re wondering how Netflix content streaming works, well, that’s just movie magic. Go ask George Lucas.