SlideShare une entreprise Scribd logo
1  sur  33
P2P music streaming	




                Ricardo Santos	

                   @ricardovice
“spotifiera”, anyone?
What is Spotify?	

•  On-demand music streaming service	

•  Available in 7 European countries	

•  Over 13 million tracks	

•  Over 1 million paying users	

•  Over 10 million total users	

•  Legal	

•  Really fast
Business idea	

•  Free ad-funded version	

•  Paid subscription where users get:	

  •  No advertisements	

  •  Mobile access	

  •  Offline playback	

  •  API access
“music itself is going to become
like running water or electricity”	

          David Bowie, 2002
Accessibility	

•  People should be able to enjoy music	

  •  Whenever they want	

  •  Wherever they are	

  •  Whatever they’re doing
That’s cool and all…	





but let’s talk engineering!
Latency sucks	

•  High latency can be a problem, not only in
  First Person Shooters	

•  Slow performance is one of the major
  reasons users abandon services	

•  Users don't come back	

How to avoid it?
Repeating songs?	


•  Player caches tracks it has played	

•  Default policy is to use 10% of free space
  (capped at 10 GB)	

•  Caches are large (56% are over 5 GB) 	

•  LRU policy for cache eviction
Streaming	

•  Request first piece from Spotify servers	

•  Meanwhile, search for peers with track	

•  Download data in-order	

•  When buffers are sufficient, switch to P2P	

•  Towards end of a track, prefetch next one
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
How well does it work?	

•  Current median latency to begin playing 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	

•  Below 1% of playbacks experienced stutter
Spotify is fast, we get it,	





but you must have cool
 infrastructure, right?
Production storage	

•  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, slightly higher latency	

•  Production storage is available in several
  data centers to ensure closeness to the
  user (latency wise)
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
Why P2P?	

•  Easier to scale	

•  Less servers	

•  Less bandwidth	

•  Better uptime	

•  Less costs	

•  Cool!
P2P overview	

•  Not a piracy network, all tracks are added
  by Spotify	

•  Used on all desktop clients	

•  All nodes are equal (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
P2P resource usage	

We care a lot about user experience, so we:	

•  Cap number of neighbors	

•  Cap number of simultaneous uploads	

  •  If buffers are very low, stop uploading	

•  Cap cache size	

•  Mobile clients don’t participate in P2P
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...)
Security	

•  P2P network needs to be safe and trusted	

•  All peers should be trusted Spotify clients	

•  Our client needs to be able to read
  metadata and play music	

•  But we have to prevent reverse
  engineering from doing the same	

Security trough obscurity: we don't openly
discuss the details…
…but here’s a few tips	

•  Closed environment	

•  Integrity of downloaded files is checked	

•  Data transfers are encrypted	

•  Usernames are not exposed in P2P
  network, all peers assigned pseudonym	

•  Software obfuscation, makes life difficult for
  reverse engineers
Software obfuscation	





according to xkcd.com
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
Not enough info?	

If you would like to know more:	

•  Get in touch with us	

•  Checkout Gunnar Kreitz's slides and
  academic papers on the subject:	

http://kreitz.se/spotify-p2p10/
Oh btw,
we have a
lotta fun
as well! :D

spotify.com/jobs
jobs@spotify.com

Contenu connexe

Tendances

Messaging queue - Kafka
Messaging queue - KafkaMessaging queue - Kafka
Messaging queue - KafkaMayank Bansal
 
Grafana introduction
Grafana introductionGrafana introduction
Grafana introductionRico Chen
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafkaemreakis
 
Music Recommendation 2018
Music Recommendation 2018Music Recommendation 2018
Music Recommendation 2018Fabien Gouyon
 
Apache Kafka: Past, Present and Future
Apache Kafka: Past, Present and FutureApache Kafka: Past, Present and Future
Apache Kafka: Past, Present and Futureconfluent
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...HostedbyConfluent
 
Developing highly scalable applications with Symfony and RabbitMQ
Developing highly scalable applications with  Symfony and RabbitMQDeveloping highly scalable applications with  Symfony and RabbitMQ
Developing highly scalable applications with Symfony and RabbitMQAlexey Petrov
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaJeff Holoman
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explainedconfluent
 
Netflix viewing data architecture evolution - QCon 2014
Netflix viewing data architecture evolution - QCon 2014Netflix viewing data architecture evolution - QCon 2014
Netflix viewing data architecture evolution - QCon 2014Philip Fisher-Ogden
 
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 20190-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019confluent
 
Apache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and DevelopersApache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and Developersconfluent
 
Facebook chat architecture
Facebook chat architectureFacebook chat architecture
Facebook chat architectureUdaya Kiran
 
A visual introduction to Apache Kafka
A visual introduction to Apache KafkaA visual introduction to Apache Kafka
A visual introduction to Apache KafkaPaul Brebner
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin PodvalMartin Podval
 
Deep Dive into Apache Kafka
Deep Dive into Apache KafkaDeep Dive into Apache Kafka
Deep Dive into Apache Kafkaconfluent
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013mumrah
 
Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...
Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...
Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...Flink Forward
 
From Idea to Execution: Spotify's Discover Weekly
From Idea to Execution: Spotify's Discover WeeklyFrom Idea to Execution: Spotify's Discover Weekly
From Idea to Execution: Spotify's Discover WeeklyChris Johnson
 

Tendances (20)

Messaging queue - Kafka
Messaging queue - KafkaMessaging queue - Kafka
Messaging queue - Kafka
 
Grafana introduction
Grafana introductionGrafana introduction
Grafana introduction
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Music Recommendation 2018
Music Recommendation 2018Music Recommendation 2018
Music Recommendation 2018
 
Apache Kafka: Past, Present and Future
Apache Kafka: Past, Present and FutureApache Kafka: Past, Present and Future
Apache Kafka: Past, Present and Future
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
 
Developing highly scalable applications with Symfony and RabbitMQ
Developing highly scalable applications with  Symfony and RabbitMQDeveloping highly scalable applications with  Symfony and RabbitMQ
Developing highly scalable applications with Symfony and RabbitMQ
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Netflix viewing data architecture evolution - QCon 2014
Netflix viewing data architecture evolution - QCon 2014Netflix viewing data architecture evolution - QCon 2014
Netflix viewing data architecture evolution - QCon 2014
 
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 20190-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
 
Apache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and DevelopersApache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and Developers
 
Facebook chat architecture
Facebook chat architectureFacebook chat architecture
Facebook chat architecture
 
A visual introduction to Apache Kafka
A visual introduction to Apache KafkaA visual introduction to Apache Kafka
A visual introduction to Apache Kafka
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin Podval
 
Deep Dive into Apache Kafka
Deep Dive into Apache KafkaDeep Dive into Apache Kafka
Deep Dive into Apache Kafka
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...
Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...
Flink Forward San Francisco 2019: Moving from Lambda and Kappa Architectures ...
 
Data at Spotify
Data at SpotifyData at Spotify
Data at Spotify
 
From Idea to Execution: Spotify's Discover Weekly
From Idea to Execution: Spotify's Discover WeeklyFrom Idea to Execution: Spotify's Discover Weekly
From Idea to Execution: Spotify's Discover Weekly
 

En vedette

Spotify: P2P music-on-demand streaming
Spotify: P2P music-on-demand streamingSpotify: P2P music-on-demand streaming
Spotify: P2P music-on-demand streamingRicardo Vice Santos
 
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
 
Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Adam Bowie
 
Peer Sim (P2P network)
Peer Sim (P2P network)Peer Sim (P2P network)
Peer Sim (P2P network)Sijo Emmanuel
 
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
 
The Future of Radio
The Future of RadioThe Future of Radio
The Future of RadioAdam Bowie
 
Music streaming websites and social media
Music streaming websites and social mediaMusic streaming websites and social media
Music streaming websites and social mediaMelanie Lucks
 
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
 

En vedette (20)

Spotify: P2P music-on-demand streaming
Spotify: P2P music-on-demand streamingSpotify: P2P music-on-demand streaming
Spotify: P2P music-on-demand streaming
 
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
 
Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09Absolute Radio - RAJAR Q2 09
Absolute Radio - RAJAR Q2 09
 
Peer Sim (P2P network)
Peer Sim (P2P network)Peer Sim (P2P network)
Peer Sim (P2P network)
 
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...
 
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
 
How is Music Marketed?
How is Music Marketed?How is Music Marketed?
How is Music Marketed?
 
Music streaming websites and social media
Music streaming websites and social mediaMusic streaming websites and social media
Music streaming websites and social media
 
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...
 

Similaire à Spotify: P2P music streaming

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
 
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
 
E-commerceG1-C1 P2P
E-commerceG1-C1 P2PE-commerceG1-C1 P2P
E-commerceG1-C1 P2Pnewnwan
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21Lorenzo Miniero
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminarbalu0503
 
FFMEET: running a non-profit conference system
FFMEET: running a non-profit conference systemFFMEET: running a non-profit conference system
FFMEET: running a non-profit conference systemAnnika Wickert
 
Digitizing and Delivering Audio and Video
Digitizing and Delivering Audio and VideoDigitizing and Delivering Audio and Video
Digitizing and Delivering Audio and VideoJenn Riley
 
JamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConferenceJamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConferenceLorenzo Miniero
 
WordCamp Lightning Talk: Podcasting and Live Streaming with WordPress
WordCamp Lightning Talk: Podcasting and Live Streaming with WordPressWordCamp Lightning Talk: Podcasting and Live Streaming with WordPress
WordCamp Lightning Talk: Podcasting and Live Streaming with WordPressDigital Strategy Works LLC
 
Concise Courses Raspberry Pi
Concise Courses Raspberry PiConcise Courses Raspberry Pi
Concise Courses Raspberry Pidjp55
 
Anon p2p slides
Anon p2p slidesAnon p2p slides
Anon p2p slideschintaan
 
Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Lorenzo Miniero
 
Network latency - measurement and improvement
Network latency - measurement and improvementNetwork latency - measurement and improvement
Network latency - measurement and improvementMatt Willsher
 

Similaire à Spotify: P2P music streaming (20)

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
 
P2P Lecture.ppt
P2P Lecture.pptP2P Lecture.ppt
P2P Lecture.ppt
 
Peer to peer(p2 p)
Peer to peer(p2 p)Peer to peer(p2 p)
Peer to peer(p2 p)
 
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
 
E-commerceG1-C1 P2P
E-commerceG1-C1 P2PE-commerceG1-C1 P2P
E-commerceG1-C1 P2P
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminar
 
Bit torrent
Bit torrentBit torrent
Bit torrent
 
FFMEET: running a non-profit conference system
FFMEET: running a non-profit conference systemFFMEET: running a non-profit conference system
FFMEET: running a non-profit conference system
 
Digitizing and Delivering Audio and Video
Digitizing and Delivering Audio and VideoDigitizing and Delivering Audio and Video
Digitizing and Delivering Audio and Video
 
BitTorrent Protocol
BitTorrent ProtocolBitTorrent Protocol
BitTorrent Protocol
 
JamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConferenceJamRTC @ Wonder WebRTC unConference
JamRTC @ Wonder WebRTC unConference
 
WordCamp Lightning Talk: Podcasting and Live Streaming with WordPress
WordCamp Lightning Talk: Podcasting and Live Streaming with WordPressWordCamp Lightning Talk: Podcasting and Live Streaming with WordPress
WordCamp Lightning Talk: Podcasting and Live Streaming with WordPress
 
Network
NetworkNetwork
Network
 
Concise Courses Raspberry Pi
Concise Courses Raspberry PiConcise Courses Raspberry Pi
Concise Courses Raspberry Pi
 
Anon p2p slides
Anon p2p slidesAnon p2p slides
Anon p2p slides
 
Torrent technology
Torrent technologyTorrent technology
Torrent technology
 
Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021
 
BitTorrent
BitTorrent BitTorrent
BitTorrent
 
Network latency - measurement and improvement
Network latency - measurement and improvementNetwork latency - measurement and improvement
Network latency - measurement and improvement
 

Dernier

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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 StrategiesBoston Institute of Analytics
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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.pdfsudhanshuwaghmare1
 
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, Adobeapidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Dernier (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Spotify: P2P music streaming

  • 1. P2P music streaming Ricardo Santos @ricardovice
  • 3. What is Spotify? •  On-demand music streaming service •  Available in 7 European countries •  Over 13 million tracks •  Over 1 million paying users •  Over 10 million total users •  Legal •  Really fast
  • 4. Business idea •  Free ad-funded version •  Paid subscription where users get: •  No advertisements •  Mobile access •  Offline playback •  API access
  • 5. “music itself is going to become like running water or electricity” David Bowie, 2002
  • 6. Accessibility •  People should be able to enjoy music •  Whenever they want •  Wherever they are •  Whatever they’re doing
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. That’s cool and all… but let’s talk engineering!
  • 12. Latency sucks •  High latency can be a problem, not only in First Person Shooters •  Slow performance is one of the major reasons users abandon services •  Users don't come back How to avoid it?
  • 13. Repeating songs? •  Player caches tracks it has played •  Default policy is to use 10% of free space (capped at 10 GB) •  Caches are large (56% are over 5 GB) •  LRU policy for cache eviction
  • 14. Streaming •  Request first piece from Spotify servers •  Meanwhile, search for peers with track •  Download data in-order •  When buffers are sufficient, switch to P2P •  Towards end of a track, prefetch next one
  • 15. 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
  • 16. How well does it work? •  Current median latency to begin playing 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 •  Below 1% of playbacks experienced stutter
  • 17. Spotify is fast, we get it, but you must have cool infrastructure, right?
  • 18.
  • 19. Production storage •  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, slightly higher latency •  Production storage is available in several data centers to ensure closeness to the user (latency wise)
  • 20. 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
  • 21.
  • 22. Why P2P? •  Easier to scale •  Less servers •  Less bandwidth •  Better uptime •  Less costs •  Cool!
  • 23. P2P overview •  Not a piracy network, all tracks are added by Spotify •  Used on all desktop clients •  All nodes are equal (no super nodes) •  A track is downloaded from several peers
  • 24. 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
  • 25. P2P resource usage We care a lot about user experience, so we: •  Cap number of neighbors •  Cap number of simultaneous uploads •  If buffers are very low, stop uploading •  Cap cache size •  Mobile clients don’t participate in P2P
  • 26. 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...)
  • 27. Security •  P2P network needs to be safe and trusted •  All peers should be trusted Spotify clients •  Our client needs to be able to read metadata and play music •  But we have to prevent reverse engineering from doing the same Security trough obscurity: we don't openly discuss the details…
  • 28. …but here’s a few tips •  Closed environment •  Integrity of downloaded files is checked •  Data transfers are encrypted •  Usernames are not exposed in P2P network, all peers assigned pseudonym •  Software obfuscation, makes life difficult for reverse engineers
  • 30. 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
  • 31.
  • 32. Not enough info? If you would like to know more: •  Get in touch with us •  Checkout Gunnar Kreitz's slides and academic papers on the subject: http://kreitz.se/spotify-p2p10/
  • 33. Oh btw, we have a lotta fun as well! :D spotify.com/jobs jobs@spotify.com