Behind The Scenes: Making Spotify More Convenient Than Piracy

If you’re in the United States, you’re probably tired of hearing about Spotify, the on-demand music service that lets you to listen to any of 13 million tracks as often as you’d like on both your PC and mobile phone. The service still hasn’t managed to close deals with the major music labels over here, but it has developed quite a following in Europe, with over 10 million users and 1 million paid subscribers. And when it finally does come stateside it might turn into an even bigger hit.

And it all started with one main business idea: make a music service that’s more convenient than piracy.

That’s one of the highlights from a presentation given by Spotify engineer Gunnar Kreitz at KTH Royal Institute of Technology last month (many of Spotify’s engineers came from KTH). Unfortunately I’m not seeing a recording of the presentation anywhere online, but Kreitz has posted the slides to his website, which you can find embedded below. The slides outline some of the key technical attributes that make Spotify what it is, many of which revolve around one key factor: speed.

According to the slides, Spotify has a median playback latency of only 265 ms, which Kreitz says “feels immediate” and avoids Spotify’s forbidden word, “Buffering”. Only 1% of songs streamed have buffering issues. In other words, the Spotify player is every bit as fast and reliable as, say, iTunes, and it’s a hell of a lot faster than finding the latest album release on BitTorrent.

Here are some of the interesting datapoints from the presentation:

  • Development is done in three week sprints, called the ‘scrum methodology’
  • Spotify uses a proprietary protocol that was designed for on-demand streaming, with most streams at Ogg Vorbis q5 @ 160kbps
  • While Spotify streams music on demand, caching is very important. The player caches your most-recently listened to tracks, and a lot of them: it uses 10% of your disk space by default (you can adjust that figure). Most Spotify users have a lot of data cached, with 56% over 5GB. And the strategy works: over 50% of data is served from the local cache, which saves a lot of bandwidth
  • When you listen to a song, the first ‘piece’ is immediately streamed from Spotify servers, and the player switches to P2P whenever possible (if P2P isn’t working, it will switch back to Spotify’s central servers).
  • P2P makes it easier for Spotify to scale, and leads to them needing fewer servers. It can also provide better uptime.
  • Mobile clients, as you’d expect, aren’t participating in P2P streaming.