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

NANOG 84: DNS Openness
NANOG 84: DNS OpennessNANOG 84: DNS Openness
NANOG 84: DNS OpennessAPNIC
 
APRICOT 2015 - NetConf for Peering Automation
APRICOT 2015 - NetConf for Peering AutomationAPRICOT 2015 - NetConf for Peering Automation
APRICOT 2015 - NetConf for Peering AutomationTom Paseka
 
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 mitigationAmmar WK
 
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 needsSteven Francia
 
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 RoutingAPNIC
 
The curse of the open recursor
The curse of the open recursorThe curse of the open recursor
The curse of the open recursorTom Paseka
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012Tomas 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

Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Adam Bowie
 
The Future of Radio
The Future of RadioThe Future of Radio
The Future of RadioAdam Bowie
 
Peer Sim (P2P network)
Peer Sim (P2P network)Peer Sim (P2P network)
Peer Sim (P2P network)Sijo Emmanuel
 
Radio Days Sweden
Radio Days SwedenRadio Days Sweden
Radio Days SwedenAdam Bowie
 
Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Adam Bowie
 
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
 
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 GlanceKhaled Husseini
 
Future of radio for today generation
Future of radio for today generationFuture of radio for today generation
Future of radio for today generationHemat Dwi Nuryanto
 
Rajar radio academy - adam bowie
Rajar   radio academy - adam bowieRajar   radio academy - adam bowie
Rajar radio academy - adam bowieAdam Bowie
 
Google July 2010
Google July 2010Google July 2010
Google July 2010Adam Bowie
 
Fjord@ The Future of Broadcasting
Fjord@ The Future of BroadcastingFjord@ The Future of Broadcasting
Fjord@ The Future of BroadcastingFjord
 
Absolute Radio Presentation
Absolute Radio PresentationAbsolute Radio Presentation
Absolute Radio PresentationAdam Bowie
 
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)Gerd Leonhard
 
Internet radio presentation
Internet radio presentationInternet radio presentation
Internet radio presentationtjbacon530
 
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
 
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 ...Gerd Leonhard
 
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 Tatiana Repkova
 
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 bookGerd 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

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 StreamingSameera Horawalavithana
 
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 ConversationsPratik Narang
 
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 replacementWei-Ning Huang
 
Network latency - measurement and improvement
Network latency - measurement and improvementNetwork latency - measurement and improvement
Network latency - measurement and improvementMatt Willsher
 
Spotify architecture - Pressing play
Spotify architecture - Pressing playSpotify architecture - Pressing play
Spotify architecture - Pressing playNiklas Gustavsson
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminarbalu0503
 
Janus Workshop pt.2 @ ClueCon 2021
Janus Workshop pt.2 @ ClueCon 2021Janus Workshop pt.2 @ ClueCon 2021
Janus Workshop pt.2 @ ClueCon 2021Lorenzo Miniero
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21Lorenzo Miniero
 
E-commerceG1-C1 P2P
E-commerceG1-C1 P2PE-commerceG1-C1 P2P
E-commerceG1-C1 P2Pnewnwan
 
JamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConferenceJamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConferenceLorenzo Miniero
 
Introduction to Computer Networking
Introduction to Computer NetworkingIntroduction to Computer Networking
Introduction to Computer NetworkingAmit Saha
 
Digitizing and Delivering Audio and Video
Digitizing and Delivering Audio and VideoDigitizing and Delivering Audio and Video
Digitizing and Delivering Audio and VideoJenn Riley
 

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

Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

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