SlideShare a Scribd company logo
1 of 23
Distributed “Web Scale” Systems



                      Ricardo Vice Santos
                            @ricardovice
Who am I?
•  I’m Ricardo!
•  Lead Engineer at Spotify
•  ricardovice on twitter, spotify, about.me, kiva, slideshare, github,
   bitbucket, delicious…
•  Portuguese
•  Previously working in the video streaming industry
•  (only) Discovered Spotify late 2009
•  Joined in 2010
spotifiera:           to use Spotify;
spo·ti·fie·ra   Verb to provide a service free of cost;
What’s Spotify all about?
•  A big catalogue, tons of music
•  Available everywhere
•  Great user experience
•  More convenient than piracy
•  Reliable, high availability
•  Scalable for many, many users
But what really got me hooked up:
•  Free, legal ad-supported service
•  Very fast
The importance of being fast
•  High latency can be a problem, not only in First
   Person Shooters
•  Slow performance is a major user experience killer
•  At Velocity 2009, Eric Schurman (Bing) and Jake
   Brutlag (Google Search) showed that increased
   latency directly hurt usage and revenue per user[1].
•  Latency leads to users leaving, many wont ever
   come back
•  Users will share their experience with friends


          [1] http://radar.oreilly.com/2009/07/velocity-making-your-site-fast.html
So how fast is Spotify?
•  We monitor playback latency on the client side
•  Current median latency to play any track is 265ms
•  On average, the human notion of “instant” is
   anything under 200ms
•  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 due to P2P”
•  This is something I read a lot around the web
•  P2P does play a crucial role in the picture, but…
•  Experience at Spotify showed me that most latency issues are
   directly linked to backend problems
•  It’s a mistake to think that we could be this fast without a smart and
   scalable backend architecture

So let’s give credit where credit is due.
Going web scale!!1




“Scaling Twitter”
Blaine Cook, 2007
http://www.slideshare.net/Blaine/scaling-twitter
Handling growth
Things to keep in mind:
•  Scaling is not an exact science
•  There is no such thing as a magic formula
•  Usage patterns differ
•  There is always a limit to what you can handle
•  Fail gracefully
•  Continuous evolution process
Scaling horizontally
•    You can always add more machines!
•    Stateless services
•    Several processes can share memcached
•    Possible to run in “the cloud” (EC2, Rackspace)
•    Need some kind of load balancer
•    Data sharing/synchronization can be hard
•    Complexity: many pieces, maybe hidden SPOFs
•    Fundamental to the application’s design
Usage patterns
Typically, some services are more demanding than
others, this can be due to:
•  Higher popularity
•  Higher complexity
•  Low latency expectation
•  All combined
Decoupling
•    Divide and conquer!
•    The Unix way
•    Resources assigned individually
•    Using the right tools to address each problem
•    Organization and delegation
•    Problems are isolated
•    Easier to handle growth
Read only services
•    The easiest to scale
•    Stateless
•    Use indices, large read-optimized data containers
•    Each node has its local copy
•    Data structured according to service
•    Updated periodically, during off-peak hours
•    Take advantage of OS page cache
Read-write services
•  User generated content, e.g. playlists
•  Hard to ensure consistence of data across instances

Solutions:
•  Eventual consistency:
   •  Reads of just written data not guaranteed to be up-to-date
•  Locking, atomic operations
    •  Creating globally unique keys, e.g. usernames
    •  Transactions, e.g. billing
Decoupling at Spotify
Finding a service via DNS
Each service has an SRV DNS record:
•  One record with same name for each service instance
•  Clients (AP) resolve to find servers providing that service
•  Lowest priority record is chosen with weighted shuffle
•  Clients retry other instances in case of failures

Example SRV record
_frobnicator._http.example.com. 3600 SRV 10     50   8081 frob1.example.com.!
       name                     TTL type prio weight port      host!
Request assignment
•    Hardware load balancers
•    Round-robin DNS
•    Proxy servers
•    Sharding:
      •  Each server/instance responsible for subset of data
      •  Directs client to instance that has its data
      •  Easy if nothing is shared
      •  Hard if you require replication
Sharding using a DHT
Some Spotify services use Dynamo inspired DHTs[1]:
•  Each request has a key
•  Each service node is responsible for a range of hash keys
•  Data is distributed among service nodes
•  Redundancy is ensured by re-hashing and writing to replica node
•  Data must be transitioned when ring changes
!




         [1] http://dl.acm.org/citation.cfm?id=1294281
DHT example
Spotify’s DNS powered DHT
Configuration of DHT
config._frobnicator._http.example.com.     3600    TXT          “slaves=0”!
      config.srv_name.                     TTL     type   !   no replication!
!
config._frobnicator._http.example.com.     3600    TXT      “slaves=2 redundancy=host”!
      config.srv_name.                     TTL!    type   !      three replicas!
                                                                on separate hosts!

Ring segment, one per node
tokens.8081.frob1.example.com.   3600    TXT      “00112233445566778899aabbccddeeff”!
      tokens.port.host.          TTL     type                last key!
!
And if none of this works for you
Remember
/dev/null is
web scale!!




          http://www.xtranormal.com/watch/6995033/
Questions?
                     get in touch!
                    @ricardovice
             ricardo@spotify.com
Thank you.

                    @ricardovice
             ricardo@spotify.com

More Related Content

What's hot

The Evolution of Big Data at Spotify
The Evolution of Big Data at SpotifyThe Evolution of Big Data at Spotify
The Evolution of Big Data at SpotifyJosh Baer
 
Building Data Pipelines for Music Recommendations at Spotify
Building Data Pipelines for Music Recommendations at SpotifyBuilding Data Pipelines for Music Recommendations at Spotify
Building Data Pipelines for Music Recommendations at SpotifyVidhya Murali
 
Algorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at SpotifyAlgorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at SpotifyChris Johnson
 
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
 
Machine Learning and Big Data for Music Discovery at Spotify
Machine Learning and Big Data for Music Discovery at SpotifyMachine Learning and Big Data for Music Discovery at Spotify
Machine Learning and Big Data for Music Discovery at SpotifyChing-Wei Chen
 
How Apache Drives Music Recommendations At Spotify
How Apache Drives Music Recommendations At SpotifyHow Apache Drives Music Recommendations At Spotify
How Apache Drives Music Recommendations At SpotifyJosh Baer
 
Storm at Spotify
Storm at SpotifyStorm at Spotify
Storm at SpotifyNeville Li
 
Music Personalization At Spotify
Music Personalization At SpotifyMusic Personalization At Spotify
Music Personalization At SpotifyVidhya Murali
 
Big Data At Spotify
Big Data At SpotifyBig Data At Spotify
Big Data At SpotifyAdam Kawa
 
How data drives spotify
How data drives spotifyHow data drives spotify
How data drives spotifyAli Sarrafi
 
Strata sf - Amundsen presentation
Strata sf - Amundsen presentationStrata sf - Amundsen presentation
Strata sf - Amundsen presentationTao Feng
 
Approximate nearest neighbor methods and vector models – NYC ML meetup
Approximate nearest neighbor methods and vector models – NYC ML meetupApproximate nearest neighbor methods and vector models – NYC ML meetup
Approximate nearest neighbor methods and vector models – NYC ML meetupErik Bernhardsson
 
Streaming sql and druid
Streaming sql and druid Streaming sql and druid
Streaming sql and druid arupmalakar
 
Real-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFiReal-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFiManish Gupta
 
Big data and machine learning @ Spotify
Big data and machine learning @ SpotifyBig data and machine learning @ Spotify
Big data and machine learning @ SpotifyOscar Carlsson
 
Introduction to Streaming Analytics
Introduction to Streaming AnalyticsIntroduction to Streaming Analytics
Introduction to Streaming AnalyticsGuido Schmutz
 

What's hot (20)

The Evolution of Big Data at Spotify
The Evolution of Big Data at SpotifyThe Evolution of Big Data at Spotify
The Evolution of Big Data at Spotify
 
Building Data Pipelines for Music Recommendations at Spotify
Building Data Pipelines for Music Recommendations at SpotifyBuilding Data Pipelines for Music Recommendations at Spotify
Building Data Pipelines for Music Recommendations at Spotify
 
Algorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at SpotifyAlgorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations 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
 
Machine Learning and Big Data for Music Discovery at Spotify
Machine Learning and Big Data for Music Discovery at SpotifyMachine Learning and Big Data for Music Discovery at Spotify
Machine Learning and Big Data for Music Discovery at Spotify
 
How Apache Drives Music Recommendations At Spotify
How Apache Drives Music Recommendations At SpotifyHow Apache Drives Music Recommendations At Spotify
How Apache Drives Music Recommendations At Spotify
 
Storm at Spotify
Storm at SpotifyStorm at Spotify
Storm at Spotify
 
Music Personalization At Spotify
Music Personalization At SpotifyMusic Personalization At Spotify
Music Personalization At Spotify
 
Big Data At Spotify
Big Data At SpotifyBig Data At Spotify
Big Data At Spotify
 
How data drives spotify
How data drives spotifyHow data drives spotify
How data drives spotify
 
Strata sf - Amundsen presentation
Strata sf - Amundsen presentationStrata sf - Amundsen presentation
Strata sf - Amundsen presentation
 
Approximate nearest neighbor methods and vector models – NYC ML meetup
Approximate nearest neighbor methods and vector models – NYC ML meetupApproximate nearest neighbor methods and vector models – NYC ML meetup
Approximate nearest neighbor methods and vector models – NYC ML meetup
 
Fraud Detection Architecture
Fraud Detection ArchitectureFraud Detection Architecture
Fraud Detection Architecture
 
Apache Nifi Crash Course
Apache Nifi Crash CourseApache Nifi Crash Course
Apache Nifi Crash Course
 
Search @ Spotify
Search @ Spotify Search @ Spotify
Search @ Spotify
 
Streaming sql and druid
Streaming sql and druid Streaming sql and druid
Streaming sql and druid
 
Apache Kafka at LinkedIn
Apache Kafka at LinkedInApache Kafka at LinkedIn
Apache Kafka at LinkedIn
 
Real-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFiReal-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFi
 
Big data and machine learning @ Spotify
Big data and machine learning @ SpotifyBig data and machine learning @ Spotify
Big data and machine learning @ Spotify
 
Introduction to Streaming Analytics
Introduction to Streaming AnalyticsIntroduction to Streaming Analytics
Introduction to Streaming Analytics
 

Viewers also liked

Spotify Brand Audit IMC 613
Spotify Brand Audit IMC 613Spotify Brand Audit IMC 613
Spotify Brand Audit IMC 613Jamie Huggins
 
Astronaut Wheelock Pictures
Astronaut Wheelock PicturesAstronaut Wheelock Pictures
Astronaut Wheelock PicturesTom Kuipers
 
Riding promotion team
Riding promotion teamRiding promotion team
Riding promotion teamJungkoo Kim
 
Sharing china photos on flickr
Sharing china photos on flickrSharing china photos on flickr
Sharing china photos on flickrLeigh Scott
 
Guide for One Person Company Registration
Guide for One Person Company RegistrationGuide for One Person Company Registration
Guide for One Person Company RegistrationBinoy Chacko
 
Kỹ năng thuyết trình
Kỹ năng thuyết trìnhKỹ năng thuyết trình
Kỹ năng thuyết trìnhLinh Pham Dieu
 
Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1Melanie Zurba
 
Vincent tema5 town
Vincent tema5 townVincent tema5 town
Vincent tema5 townJacket25
 
Azkena rock
Azkena rockAzkena rock
Azkena rockaneborja
 
Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1Melanie Zurba
 
Two wrongs don’t make a right
Two wrongs don’t make a rightTwo wrongs don’t make a right
Two wrongs don’t make a rightBillGENGL1021
 

Viewers also liked (20)

Spotify Brand Audit IMC 613
Spotify Brand Audit IMC 613Spotify Brand Audit IMC 613
Spotify Brand Audit IMC 613
 
Astronaut Wheelock Pictures
Astronaut Wheelock PicturesAstronaut Wheelock Pictures
Astronaut Wheelock Pictures
 
Riding promotion team
Riding promotion teamRiding promotion team
Riding promotion team
 
Who is HAYAL KÖKSAL? What has she done in 40 years of teaching life?
Who is HAYAL KÖKSAL? What has she done in 40 years of teaching life?Who is HAYAL KÖKSAL? What has she done in 40 years of teaching life?
Who is HAYAL KÖKSAL? What has she done in 40 years of teaching life?
 
2016 Leading Seagulls 4 Todays Interns
2016 Leading Seagulls 4 Todays Interns 2016 Leading Seagulls 4 Todays Interns
2016 Leading Seagulls 4 Todays Interns
 
Sharing china photos on flickr
Sharing china photos on flickrSharing china photos on flickr
Sharing china photos on flickr
 
Quechua
QuechuaQuechua
Quechua
 
17 icsqcc hayal koksal
17 icsqcc hayal koksal17 icsqcc hayal koksal
17 icsqcc hayal koksal
 
Guide for One Person Company Registration
Guide for One Person Company RegistrationGuide for One Person Company Registration
Guide for One Person Company Registration
 
www.toneabs.info
www.toneabs.infowww.toneabs.info
www.toneabs.info
 
Kỹ năng thuyết trình
Kỹ năng thuyết trìnhKỹ năng thuyết trình
Kỹ năng thuyết trình
 
Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1
 
Bibliotecas famosas
Bibliotecas famosasBibliotecas famosas
Bibliotecas famosas
 
Lurdes
LurdesLurdes
Lurdes
 
2016 leading seagulls 7 teacher candy dates
2016 leading seagulls 7 teacher candy dates2016 leading seagulls 7 teacher candy dates
2016 leading seagulls 7 teacher candy dates
 
Vincent tema5 town
Vincent tema5 townVincent tema5 town
Vincent tema5 town
 
Azkena rock
Azkena rockAzkena rock
Azkena rock
 
Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1Geo23.1102 winter2015 session1
Geo23.1102 winter2015 session1
 
2016 leading seagulls 16 beautiful minds
2016 leading seagulls 16 beautiful minds 2016 leading seagulls 16 beautiful minds
2016 leading seagulls 16 beautiful minds
 
Two wrongs don’t make a right
Two wrongs don’t make a rightTwo wrongs don’t make a right
Two wrongs don’t make a right
 

Similar to Distributed "Web Scale" Systems

Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Bob Pusateri
 
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
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkTomas Doran
 
Putting Kafka Into Overdrive
Putting Kafka Into OverdrivePutting Kafka Into Overdrive
Putting Kafka Into OverdriveTodd Palino
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterJohn Adams
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)Panagiotis Kanavos
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudyJohn Adams
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)Panagiotis Kanavos
 
Bullet: A Real Time Data Query Engine
Bullet: A Real Time Data Query EngineBullet: A Real Time Data Query Engine
Bullet: A Real Time Data Query EngineDataWorks Summit
 
Design for Scale / Surge 2010
Design for Scale / Surge 2010Design for Scale / Surge 2010
Design for Scale / Surge 2010Christopher Brown
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remanijaxconf
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling SoftwareAbdelmonaim Remani
 
Setting Up .Onion Addresses for your Enterprise, v3.5
Setting Up .Onion Addresses for your Enterprise, v3.5Setting Up .Onion Addresses for your Enterprise, v3.5
Setting Up .Onion Addresses for your Enterprise, v3.5Alec Muffett
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitterRoger Xia
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...smallerror
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...xlight
 
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...Bob Pusateri
 
Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...
Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...
Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...Bob Pusateri
 

Similar to Distributed "Web Scale" Systems (20)

Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
 
Spotify: P2P music-on-demand streaming
Spotify: P2P music-on-demand streamingSpotify: P2P music-on-demand streaming
Spotify: P2P music-on-demand streaming
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
Putting Kafka Into Overdrive
Putting Kafka Into OverdrivePutting Kafka Into Overdrive
Putting Kafka Into Overdrive
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
Realtime web2012
Realtime web2012Realtime web2012
Realtime web2012
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
 
Bullet: A Real Time Data Query Engine
Bullet: A Real Time Data Query EngineBullet: A Real Time Data Query Engine
Bullet: A Real Time Data Query Engine
 
Design for Scale / Surge 2010
Design for Scale / Surge 2010Design for Scale / Surge 2010
Design for Scale / Surge 2010
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remani
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling Software
 
Setting Up .Onion Addresses for your Enterprise, v3.5
Setting Up .Onion Addresses for your Enterprise, v3.5Setting Up .Onion Addresses for your Enterprise, v3.5
Setting Up .Onion Addresses for your Enterprise, v3.5
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
 
Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...
Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...
Select Stars: A DBA's Guide to Azure Cosmos DB (Chicago Suburban SQL Server U...
 

Recently uploaded

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 Scriptwesley chun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
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)

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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
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
 

Distributed "Web Scale" Systems

  • 1. Distributed “Web Scale” Systems Ricardo Vice Santos @ricardovice
  • 2. Who am I? •  I’m Ricardo! •  Lead Engineer at Spotify •  ricardovice on twitter, spotify, about.me, kiva, slideshare, github, bitbucket, delicious… •  Portuguese •  Previously working in the video streaming industry •  (only) Discovered Spotify late 2009 •  Joined in 2010
  • 3. spotifiera: to use Spotify; spo·ti·fie·ra Verb to provide a service free of cost;
  • 4. What’s Spotify all about? •  A big catalogue, tons of music •  Available everywhere •  Great user experience •  More convenient than piracy •  Reliable, high availability •  Scalable for many, many users But what really got me hooked up: •  Free, legal ad-supported service •  Very fast
  • 5. The importance of being fast •  High latency can be a problem, not only in First Person Shooters •  Slow performance is a major user experience killer •  At Velocity 2009, Eric Schurman (Bing) and Jake Brutlag (Google Search) showed that increased latency directly hurt usage and revenue per user[1]. •  Latency leads to users leaving, many wont ever come back •  Users will share their experience with friends [1] http://radar.oreilly.com/2009/07/velocity-making-your-site-fast.html
  • 6. So how fast is Spotify? •  We monitor playback latency on the client side •  Current median latency to play any track is 265ms •  On average, the human notion of “instant” is anything under 200ms •  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
  • 7. “Spotify is fast due to P2P” •  This is something I read a lot around the web •  P2P does play a crucial role in the picture, but… •  Experience at Spotify showed me that most latency issues are directly linked to backend problems •  It’s a mistake to think that we could be this fast without a smart and scalable backend architecture So let’s give credit where credit is due.
  • 8. Going web scale!!1 “Scaling Twitter” Blaine Cook, 2007 http://www.slideshare.net/Blaine/scaling-twitter
  • 9. Handling growth Things to keep in mind: •  Scaling is not an exact science •  There is no such thing as a magic formula •  Usage patterns differ •  There is always a limit to what you can handle •  Fail gracefully •  Continuous evolution process
  • 10. Scaling horizontally •  You can always add more machines! •  Stateless services •  Several processes can share memcached •  Possible to run in “the cloud” (EC2, Rackspace) •  Need some kind of load balancer •  Data sharing/synchronization can be hard •  Complexity: many pieces, maybe hidden SPOFs •  Fundamental to the application’s design
  • 11. Usage patterns Typically, some services are more demanding than others, this can be due to: •  Higher popularity •  Higher complexity •  Low latency expectation •  All combined
  • 12. Decoupling •  Divide and conquer! •  The Unix way •  Resources assigned individually •  Using the right tools to address each problem •  Organization and delegation •  Problems are isolated •  Easier to handle growth
  • 13. Read only services •  The easiest to scale •  Stateless •  Use indices, large read-optimized data containers •  Each node has its local copy •  Data structured according to service •  Updated periodically, during off-peak hours •  Take advantage of OS page cache
  • 14. Read-write services •  User generated content, e.g. playlists •  Hard to ensure consistence of data across instances Solutions: •  Eventual consistency: •  Reads of just written data not guaranteed to be up-to-date •  Locking, atomic operations •  Creating globally unique keys, e.g. usernames •  Transactions, e.g. billing
  • 16. Finding a service via DNS Each service has an SRV DNS record: •  One record with same name for each service instance •  Clients (AP) resolve to find servers providing that service •  Lowest priority record is chosen with weighted shuffle •  Clients retry other instances in case of failures Example SRV record _frobnicator._http.example.com. 3600 SRV 10 50 8081 frob1.example.com.! name TTL type prio weight port host!
  • 17. Request assignment •  Hardware load balancers •  Round-robin DNS •  Proxy servers •  Sharding: •  Each server/instance responsible for subset of data •  Directs client to instance that has its data •  Easy if nothing is shared •  Hard if you require replication
  • 18. Sharding using a DHT Some Spotify services use Dynamo inspired DHTs[1]: •  Each request has a key •  Each service node is responsible for a range of hash keys •  Data is distributed among service nodes •  Redundancy is ensured by re-hashing and writing to replica node •  Data must be transitioned when ring changes ! [1] http://dl.acm.org/citation.cfm?id=1294281
  • 20. Spotify’s DNS powered DHT Configuration of DHT config._frobnicator._http.example.com. 3600 TXT “slaves=0”! config.srv_name. TTL type ! no replication! ! config._frobnicator._http.example.com. 3600 TXT “slaves=2 redundancy=host”! config.srv_name. TTL! type ! three replicas! on separate hosts! Ring segment, one per node tokens.8081.frob1.example.com. 3600 TXT “00112233445566778899aabbccddeeff”! tokens.port.host. TTL type last key! !
  • 21. And if none of this works for you Remember /dev/null is web scale!! http://www.xtranormal.com/watch/6995033/
  • 22. Questions? get in touch! @ricardovice ricardo@spotify.com
  • 23. Thank you. @ricardovice ricardo@spotify.com