Professional Documents
Culture Documents
Spotify - Behind The Scenes: Gunnar Kreitz
Spotify - Behind The Scenes: Gunnar Kreitz
Streaming
P2P Protocol
Gunnar Kreitz
Spotify
gkreitz@spotify.com
What is Spotify?
Business Idea
Business Idea
Development Environment
I Available
I Fast
I Scalable
I Secure
Client Software
Everything is a link
Everything is a link
Metadata API
I Proprietary protocol
I Designed for on-demand streaming
I Only Spotify can add tracks
I 96–320 kbps audio streams (most are Ogg Vorbis q5, 160 kbps)
I Peer-assisted streaming
Spotify Protocol
Caches
Streaming a Track
P2P Goals
I Easier to scale
I Less servers
I Lass bandwidth
I Better uptime
I Fun!
Music Movies
I Small (5 minutes, 5 MB) I Large (2 hours, 1.5 GB)
I Many plays/session I High bit rate
I Large catalog
I Active users
Main problem: peer discovery Main problem: download strategy
Music Movies
I Small (5 minutes, 5 MB) I Large (2 hours, 1.5 GB)
I Many plays/session I High bit rate
I Large catalog
I Active users
Main problem: peer discovery Main problem: download strategy
P2P Structure
P2P Structure
I One (well, two) P2P overlay for all tracks (not per-torrent)
I Does not inform peers about downloaded blocks
I Downloads blocks in order
I Does not enforce fairness (such as tit-for-tat)
I Informs peers about urgency of request
Finding Peers
Downloading in P2P
Avoiding hijacking
High-level overview
Playlist
Proprietary
HTTP Search
Client Proprietary AP HTTP
HTTP Storage
User
Lookup, version 1
Lookup, version 2
Storage
Playlist
Evaluation
Data Sources
90
80
70
Weekend
60 Night
Weekday
50 Morning
%
40
30
20
10
0
Mon Tue Wed Thu Fri Sat Sun Mon
Cur: Min: Avg:
Server 10.86 6.76 9.62
P2P 33.90 23.78 33.86
Cache 55.24 48.47 56.53
Data Sources
Finding Peers
Protocol Overhead