How Spotify scaled its backend
Hundreds of autonomous services, and the cloud migration that took years
Spotify runs a real-time streaming product for a huge global user base, backed by hundreds of independently owned backend services - the architectural challenge isn't one hard technical problem, it's keeping that many services, owned by that many small autonomous teams, reliable and consistent at once.
Spotify serves a large global base of listeners simultaneously streaming audio, backed by a backend built from several hundred microservices - and for years that backend ran primarily on Spotify's own data centers before a deliberate, multi-year migration moved nearly all of it onto Google Cloud Platform.
Interactive
Spotify’s stack, mapped
Grouped by where each piece sits in the request path. Click through to see what each one is actually for.
Infrastructure
Edge & delivery
Services & language
Data & messaging
Backend language (core)
·Java
The primary language for the large majority of Spotify's backend services, chosen for its mature tooling and performance characteristics across a very large number of independently run services.
Click a piece of Spotify’s stack to see what it’s for
The same stack, in plain language
Java
Backend language (core)
The primary language for the large majority of Spotify's backend services, chosen for its mature tooling and performance characteristics across a very large number of independently run services.
Python
Backend language (data & tooling)
Used across a number of Spotify's data engineering and internal tooling services, alongside Java, particularly where rapid iteration mattered more than raw runtime performance.
Google Cloud Platform
Cloud provider
The destination of Spotify's multi-year migration off its own data centers - compute, storage, and managed services that Spotify's infrastructure teams no longer have to run and maintain themselves.
Cassandra
Database
Used across a number of Spotify's services for data that needs to be written and read at high volume with availability prioritized over strict consistency, similar to its role at other large-scale streaming and social platforms.
Google Cloud Pub/Sub
Event delivery / messaging
Part of Spotify's event delivery system after its cloud migration, used to move events - like a play, a skip, a follow - between services asynchronously, replacing earlier in-house messaging infrastructure built for its own data centers.
Apache Beam / Scio
Data processing
Scio is a Scala API for Apache Beam that Spotify built and open-sourced, used to write the large-scale data processing pipelines - like the ones behind Spotify's personalized playlists - that need to run the same logic over both real-time streams and historical batch data.
Docker
Containerization
Spotify's backend services run as containers, packaged consistently regardless of which underlying language or team built them, which is what made a uniform deployment and scheduling story across hundreds of independently owned services possible in the first place.
Kubernetes (Google Kubernetes Engine)
Container orchestration
Following the move to Google Cloud, Spotify runs much of its service fleet on GKE, scheduling and scaling containers across the cloud infrastructure it migrated onto rather than infrastructure it operates itself.
How it actually works
A multi-year migration off self-managed data centers
Spotify has published extensively about moving its backend off infrastructure it ran itself and onto Google Cloud Platform - a migration the company has been open about taking several years, service by service, rather than as a single cutover. The publicly stated motivation was letting engineering teams focus on product logic instead of operating physical infrastructure, and getting access to managed services (storage, messaging, data processing) instead of building and maintaining equivalents in-house indefinitely.
Backend for Frontend: one API layer per client, not one API for everyone
Spotify is one of the most frequently cited examples of the Backend for Frontend (BFF) pattern - building a dedicated backend API layer tailored to each client surface (mobile, desktop, web) instead of forcing every client to consume one generic, shared API. The reasoning documented in their engineering writing is that a mobile client and a desktop client often need meaningfully different data shapes and call patterns, and a single generic API ends up compromising for all of them rather than serving any one well.
Rebuilding event delivery around managed cloud messaging
As part of the cloud migration, Spotify's engineering blog has documented rebuilding its event delivery system - the pipeline that moves events like plays, skips, and follows between services and into analytics - around Google Cloud Pub/Sub, replacing earlier infrastructure that had been built for Spotify's own data centers. The stated challenge wasn't just swapping one message broker for another; it meant re-examining assumptions the old system had made about ordering, delivery guarantees, and scale that didn't automatically carry over to the new platform.
Squads: small, autonomous teams that own their services end to end
Spotify's well-known 'squad' model - small, cross-functional teams with end-to-end ownership of a specific piece of the product - is as much an organizational structure as a technical one, but the two are directly connected: hundreds of independently deployable services only work well if each one has a clear, accountable owner. A squad owning a service means that team decides its architecture, its on-call rotation, and its release schedule, rather than changes needing sign-off from a central team that owns everything.
What “microservices” means here, concretely
Spotify's backend is built from several hundred independently deployable microservices, primarily in Java with some in Python, each owned end to end by a small 'squad,' packaged as Docker containers and scheduled on Kubernetes - a structure that only works because ownership boundaries are as clearly defined organizationally as they are technically.
Takeaway
Spotify's public engineering writing keeps circling back to the same idea from two directions - technically, hundreds of small services instead of one large one; organizationally, hundreds of small autonomous teams instead of one large one - and treats the two as inseparable, not as a technical decision made independently of how the teams themselves are structured.
Based on
- Spotify Engineering Blog - Spotify's journey to the cloud
- Spotify Engineering Blog - event delivery, from on-prem to Google Cloud Pub/Sub
- Spotify Engineering - open-sourcing Scio, a Scala API for Apache Beam
More profiles
Netflix
Designing for failure instead of hoping it won't happen
Uber
A dispatch problem that's really a real-time geospatial problem
Discord
Millions of concurrent WebSocket connections, and the language choices that followed
Stripe
Money can't be 'probably correct' - reliability as the actual product
Airbnb
Breaking apart a Ruby on Rails monolith without breaking the business