SlideShare a Scribd company logo
1 of 25
Spotify: P2P music-on-
demand streaming
Ricardo Santos – Spotify
@ricardovice
Basic requirements
• Lots of music
• Available everywhere, with great user interfaces
• More convenient than piracy
• Fast start of playback
• High availability (enough nines to put CDs in the
basement)
• Large scale (many many users)
The music
• Over 10 million tracks
• Growing every day, around 10k per day
• 96-320 kbps audio streams, most are Ogg
Vorbis q5, 160kbps
Accessibility
• People should always be able to access
music
• Whenever they want
• Wherever they are
but enough with the
marketing talk...
Latency matters
• High latency can be a problem, not only in
First Person Shooters
• Increased latency of Google searches by 100
– 400ms decreased usage by 0.2 – 0.6% (Jake
Brutlag, 2009)
• Slow performance is one of the major
reasons users abandon services
• Users don't come back
Latency matters
• Focus on low latency
• On average, the human notion of “instantly” is 200ms
• The median latency to begin play a track in Spotify is
265ms
• Due to disk lookup, at times it's actually faster to start
playing a track from network than from disk
• The SLA is maintained by monitoring latency in the client
Playing a track
• Check local cache
• Request first piece from Spotify servers
• Meanwhile, search P2P for remainder
• Switch between servers & P2P as needed
• Towards the end of a track, start pre-
fetching the next one via P2P rather than
our servers
When to start playing?
• Trade off between stutter & latency
• Look at last 15 min of transfer rates
• Model as Markov chain and simulate
• Coupled with some heuristics
• Production storage is a cache with fast drives &
lots of RAM
• Serves the most popular content
• A cache miss will generate a request to master
storage
• User will experience longer latency
• Production storage is available in several data
centers to ensure closeness to the user (latency
wise)
Production storage
Master storage
• Works as a DHT, with some redundancy
• Contains all available tracks but has slower
drives and access
• Tracks are kept in several formats, adding
up to around 290TB
P2P helps
• Easier to scale
• Less servers
• Less bandwidth
• Better uptime
• Less costs
• Fun!
P2P overview
• Not a piracy network, all tracks are added
by Spotify
• Used on all desktop clients (no mobile)
• Each client connected to <= 60 others
• All nodes are equals (no super nodes)
• A track is downloaded from several peers
P2P custom protocol
• Ask for most urgent pieces first
• If a peer is slow, re-request from new peers
• When buffers run low, download from
central servers
• If loading from servers, estimate at what
point P2P will catch up
• If buffers are very low, stop uploading
P2P finding peers
• Partial central tracker (BitTorrent-style)
• Broadcast query in small neighborhood
(Gnutella-style)
• Two mechanisms results in higher
availability
• Limited broadcast for local (LAN) peer
discovery (cherry on top...)
P2P security
• The client needs to be able to play music, but we have to
prevent reverse engineering from doing the same
• Therefor we can't openly discuss the details (Security
Trough Obscurity) but...
• Closed environment
• Verify integrity of downloaded files
• Data transfers are encrypted
• Usernames are not exposed in P2P network, all peers
assigned pseudonym
So, what's the
outcome?
• At over 10 million users the responses are
• 55.4% from client cache
• 35.8% from the P2P network
• 8.8% from the servers
I'd like to know more...
• Get in touch with us
• Checkout Gunnar Kreitz's slides and
academic papers on the subject:
http://www.csc.kth.se/~gkreitz/spotify-p2p10/
Oh, and
we have
cake as
well! :D
spotify.com/jobs
jobs@spotify.com

More Related Content

What's hot

The curse of the open recursor
The curse of the open recursorThe curse of the open recursor
The curse of the open recursor
Tom Paseka
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012
Tomas Doran
 

What's hot (9)

NANOG 84: DNS Openness
NANOG 84: DNS OpennessNANOG 84: DNS Openness
NANOG 84: DNS Openness
 
SPDY Talk
SPDY TalkSPDY Talk
SPDY Talk
 
APRICOT 2015 - NetConf for Peering Automation
APRICOT 2015 - NetConf for Peering AutomationAPRICOT 2015 - NetConf for Peering Automation
APRICOT 2015 - NetConf for Peering Automation
 
Layer 7 denial of services attack mitigation
Layer 7 denial of services attack mitigationLayer 7 denial of services attack mitigation
Layer 7 denial of services attack mitigation
 
What every successful open source project needs
What every successful open source project needsWhat every successful open source project needs
What every successful open source project needs
 
BSides: BGP Hijacking and Secure Internet Routing
BSides: BGP Hijacking and Secure Internet RoutingBSides: BGP Hijacking and Secure Internet Routing
BSides: BGP Hijacking and Secure Internet Routing
 
The curse of the open recursor
The curse of the open recursorThe curse of the open recursor
The curse of the open recursor
 
FVCP 20200610
FVCP 20200610FVCP 20200610
FVCP 20200610
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012
 

Viewers also liked

Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...
Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...
Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...
Xavier Damman
 
Rajar radio academy - adam bowie
Rajar   radio academy - adam bowieRajar   radio academy - adam bowie
Rajar radio academy - adam bowie
Adam Bowie
 
Google July 2010
Google July 2010Google July 2010
Google July 2010
Adam Bowie
 
2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...
2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...
2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...
Gerd Leonhard
 
Technology vs Humanity: key themes from Futurist Gerd Leonhard's new book
Technology vs Humanity: key themes from Futurist Gerd Leonhard's new bookTechnology vs Humanity: key themes from Futurist Gerd Leonhard's new book
Technology vs Humanity: key themes from Futurist Gerd Leonhard's new book
Gerd Leonhard
 

Viewers also liked (20)

Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09
 
The Future of Radio
The Future of RadioThe Future of Radio
The Future of Radio
 
Rajar 2009 Q4
Rajar 2009 Q4Rajar 2009 Q4
Rajar 2009 Q4
 
Peer Sim (P2P network)
Peer Sim (P2P network)Peer Sim (P2P network)
Peer Sim (P2P network)
 
Radio Days Sweden
Radio Days SwedenRadio Days Sweden
Radio Days Sweden
 
Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09
 
Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...
Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...
Social Media is a human p2p network. And Uber and AirBnb are the Napster of t...
 
Future Of Online Radio Middle East Glance
Future Of Online Radio   Middle East GlanceFuture Of Online Radio   Middle East Glance
Future Of Online Radio Middle East Glance
 
Future of radio for today generation
Future of radio for today generationFuture of radio for today generation
Future of radio for today generation
 
Rajar radio academy - adam bowie
Rajar   radio academy - adam bowieRajar   radio academy - adam bowie
Rajar radio academy - adam bowie
 
Future of the broadcasting spectrum
Future of the broadcasting spectrum Future of the broadcasting spectrum
Future of the broadcasting spectrum
 
Google July 2010
Google July 2010Google July 2010
Google July 2010
 
Fjord@ The Future of Broadcasting
Fjord@ The Future of BroadcastingFjord@ The Future of Broadcasting
Fjord@ The Future of Broadcasting
 
Absolute Radio Presentation
Absolute Radio PresentationAbsolute Radio Presentation
Absolute Radio Presentation
 
The Future of Radio and Broadcasting (Gerd Leonhard, The Futures Agency)
The Future of Radio and Broadcasting (Gerd Leonhard, The Futures Agency)The Future of Radio and Broadcasting (Gerd Leonhard, The Futures Agency)
The Future of Radio and Broadcasting (Gerd Leonhard, The Futures Agency)
 
Internet radio presentation
Internet radio presentationInternet radio presentation
Internet radio presentation
 
2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...
2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...
2020 global digital transformation communicasia Gerd Leonhard Futurist Speake...
 
The future of marketing, advertising and the Internet: Futurist Speaker Gerd ...
The future of marketing, advertising and the Internet: Futurist Speaker Gerd ...The future of marketing, advertising and the Internet: Futurist Speaker Gerd ...
The future of marketing, advertising and the Internet: Futurist Speaker Gerd ...
 
News Media 2017: Trends & Forecasts in headlines
News Media 2017: Trends & Forecasts in headlines News Media 2017: Trends & Forecasts in headlines
News Media 2017: Trends & Forecasts in headlines
 
Technology vs Humanity: key themes from Futurist Gerd Leonhard's new book
Technology vs Humanity: key themes from Futurist Gerd Leonhard's new bookTechnology vs Humanity: key themes from Futurist Gerd Leonhard's new book
Technology vs Humanity: key themes from Futurist Gerd Leonhard's new book
 

Similar to Spotify: P2P music-on-demand streaming

Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminar
balu0503
 
E-commerceG1-C1 P2P
E-commerceG1-C1 P2PE-commerceG1-C1 P2P
E-commerceG1-C1 P2P
newnwan
 

Similar to Spotify: P2P music-on-demand streaming (20)

Talk on Spotify: Large Scale, Low Latency, P2P Music-on-Demand Streaming
Talk on Spotify: Large Scale, Low Latency, P2P Music-on-Demand StreamingTalk on Spotify: Large Scale, Low Latency, P2P Music-on-Demand Streaming
Talk on Spotify: Large Scale, Low Latency, P2P Music-on-Demand Streaming
 
P2P Lecture.ppt
P2P Lecture.pptP2P Lecture.ppt
P2P Lecture.ppt
 
P2P Forensics
P2P ForensicsP2P Forensics
P2P Forensics
 
PeerShark - Detecting Peer-to-Peer Botnets by Tracking Conversations
PeerShark - Detecting Peer-to-Peer Botnets by Tracking ConversationsPeerShark - Detecting Peer-to-Peer Botnets by Tracking Conversations
PeerShark - Detecting Peer-to-Peer Botnets by Tracking Conversations
 
ProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacement
 
Network latency - measurement and improvement
Network latency - measurement and improvementNetwork latency - measurement and improvement
Network latency - measurement and improvement
 
Spotify architecture - Pressing play
Spotify architecture - Pressing playSpotify architecture - Pressing play
Spotify architecture - Pressing play
 
How to video.
How to video.How to video.
How to video.
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminar
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Janus Workshop pt.2 @ ClueCon 2021
Janus Workshop pt.2 @ ClueCon 2021Janus Workshop pt.2 @ ClueCon 2021
Janus Workshop pt.2 @ ClueCon 2021
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
BitTorrent Protocol
BitTorrent ProtocolBitTorrent Protocol
BitTorrent Protocol
 
E-commerceG1-C1 P2P
E-commerceG1-C1 P2PE-commerceG1-C1 P2P
E-commerceG1-C1 P2P
 
JamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConferenceJamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConference
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Introduction to Computer Networking
Introduction to Computer NetworkingIntroduction to Computer Networking
Introduction to Computer Networking
 
Peer to peer(p2 p)
Peer to peer(p2 p)Peer to peer(p2 p)
Peer to peer(p2 p)
 
Digitizing and Delivering Audio and Video
Digitizing and Delivering Audio and VideoDigitizing and Delivering Audio and Video
Digitizing and Delivering Audio and Video
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Spotify: P2P music-on-demand streaming

  • 1. Spotify: P2P music-on- demand streaming Ricardo Santos – Spotify @ricardovice
  • 2. Basic requirements • Lots of music • Available everywhere, with great user interfaces • More convenient than piracy • Fast start of playback • High availability (enough nines to put CDs in the basement) • Large scale (many many users)
  • 3. The music • Over 10 million tracks • Growing every day, around 10k per day • 96-320 kbps audio streams, most are Ogg Vorbis q5, 160kbps
  • 4. Accessibility • People should always be able to access music • Whenever they want • Wherever they are
  • 5.
  • 6.
  • 7.
  • 8. but enough with the marketing talk...
  • 9. Latency matters • High latency can be a problem, not only in First Person Shooters • Increased latency of Google searches by 100 – 400ms decreased usage by 0.2 – 0.6% (Jake Brutlag, 2009) • Slow performance is one of the major reasons users abandon services • Users don't come back
  • 10. Latency matters • Focus on low latency • On average, the human notion of “instantly” is 200ms • The median latency to begin play a track in Spotify is 265ms • Due to disk lookup, at times it's actually faster to start playing a track from network than from disk • The SLA is maintained by monitoring latency in the client
  • 11. Playing a track • Check local cache • Request first piece from Spotify servers • Meanwhile, search P2P for remainder • Switch between servers & P2P as needed • Towards the end of a track, start pre- fetching the next one via P2P rather than our servers
  • 12. When to start playing? • Trade off between stutter & latency • Look at last 15 min of transfer rates • Model as Markov chain and simulate • Coupled with some heuristics
  • 13.
  • 14. • Production storage is a cache with fast drives & lots of RAM • Serves the most popular content • A cache miss will generate a request to master storage • User will experience longer latency • Production storage is available in several data centers to ensure closeness to the user (latency wise) Production storage
  • 15. Master storage • Works as a DHT, with some redundancy • Contains all available tracks but has slower drives and access • Tracks are kept in several formats, adding up to around 290TB
  • 16.
  • 17. P2P helps • Easier to scale • Less servers • Less bandwidth • Better uptime • Less costs • Fun!
  • 18. P2P overview • Not a piracy network, all tracks are added by Spotify • Used on all desktop clients (no mobile) • Each client connected to <= 60 others • All nodes are equals (no super nodes) • A track is downloaded from several peers
  • 19. P2P custom protocol • Ask for most urgent pieces first • If a peer is slow, re-request from new peers • When buffers run low, download from central servers • If loading from servers, estimate at what point P2P will catch up • If buffers are very low, stop uploading
  • 20. P2P finding peers • Partial central tracker (BitTorrent-style) • Broadcast query in small neighborhood (Gnutella-style) • Two mechanisms results in higher availability • Limited broadcast for local (LAN) peer discovery (cherry on top...)
  • 21. P2P security • The client needs to be able to play music, but we have to prevent reverse engineering from doing the same • Therefor we can't openly discuss the details (Security Trough Obscurity) but... • Closed environment • Verify integrity of downloaded files • Data transfers are encrypted • Usernames are not exposed in P2P network, all peers assigned pseudonym
  • 22. So, what's the outcome? • At over 10 million users the responses are • 55.4% from client cache • 35.8% from the P2P network • 8.8% from the servers
  • 23.
  • 24. I'd like to know more... • Get in touch with us • Checkout Gunnar Kreitz's slides and academic papers on the subject: http://www.csc.kth.se/~gkreitz/spotify-p2p10/
  • 25. Oh, and we have cake as well! :D spotify.com/jobs jobs@spotify.com