Spotify System Architecture: Microservices, Event Delivery, and Google Cloud
Spotify's backend is a set of several hundred microservices, mostly written in Java, running on Kubernetes in Google Cloud. Each service is owned by one small team, called a squad. Backstage, which Spotify built and later open-sourced, is the catalog that tells engineers what every service is and who owns it. Audio files are served through content delivery networks, and every user action becomes an event in a pipeline that peaks above 8 million events per second.
That is the architecture at the level a system design interview needs. The rest of this page explains each part and gives you a walkthrough you can draw on a whiteboard.
The main parts
| Part | What it does | Technology Spotify has described |
|---|---|---|
| Clients | Desktop, mobile, web, and speaker apps | Native apps that talk to a backend access point |
| Access point | Terminates client connections and routes requests to services | Spotify's own gateway layer |
| Microservices | Playlists, search, user accounts, playback, recommendations | Java services, some Python, on Kubernetes |
| Service catalog | Records every service, its owner, its docs, and its health | Backstage |
| Audio delivery | Serves encrypted audio segments close to the listener | Content delivery networks with object storage behind them |
| Event delivery | Collects plays, skips, and searches for analytics and features | Cloud Pub/Sub, Dataflow, Cloud Storage, BigQuery |
| Data storage | Per-service databases, never a shared one | Cassandra historically, Google managed stores after the migration |
Two decisions explain most of this table. Spotify split into microservices early so that squads could deploy independently. Then it moved everything from four of its own data centers to Google Cloud, so that the squads could stop running infrastructure.
A numbered walkthrough: pressing play
- The client asks the access point for a track. The request includes the user's session and the track identifier.
- The playback service checks the user's rights. A free user and a premium user get different answers, and a track that is not licensed in the user's country is refused.
- The metadata services answer in parallel. Track, album, and artist details come from separate services, each with its own store. This is the microservice pattern: one team owns one kind of data.
- The client fetches audio from a CDN. The backend returns where the audio lives, not the audio itself. The client then streams segments from the nearest CDN edge, which is why the backend can be far away without a delay you notice.
- The client sends events. A play start, a skip, and a completed track each become an event.
- The event pipeline stores and processes the events. They feed Discover Weekly, Wrapped, royalty reports, and A/B test results.
In an interview, draw steps 1 to 4 as the request path and steps 5 to 6 as the asynchronous path. Interviewers look for that separation.
The event delivery pipeline
Event delivery is the part of Spotify's architecture with the most published numbers. Spotify has stated that the system handles more than 500 distinct event types and more than 350 terabytes of raw events a day, with a peak above 8 million events per second.
The pipeline began on self-managed Apache Kafka. Spotify ran the Kafka system and a Cloud Pub/Sub system side by side for about a year, compared the data, and then shut Kafka down. Downstream, Dataflow jobs written with Scio, Spotify's Scala library for Apache Beam, clean and deduplicate the events into Cloud Storage and BigQuery.
| Question | Self-managed Kafka | Cloud Pub/Sub |
|---|---|---|
| Who runs the brokers | Spotify's own team | |
| Adding capacity | Buy and configure machines | Change a quota |
| Delivery guarantee Spotify relies on | At least once, with deduplication later | At least once, with deduplication later |
| Main reason for the switch | Operational load | Squads could focus on product work |
The lesson for a design interview is that the choice was not about throughput. Both systems could handle the load. The choice was about who does the operational work.
Why microservices worked for Spotify
Microservices matched Spotify's team structure. A squad owns a service end to end: code, deployment, and on-call. Because each service has its own store, one squad's schema change cannot break another squad's release.
The cost was duplication. Each squad built its own deployment pipeline and monitoring, and Spotify has said it ended up with many versions of the same tooling. Backstage was the fix: one catalog, one set of templates, and a supported default path for building a new service, which Spotify calls a Golden Path.
Spotify also moved its container scheduling from Helios, its own tool, to Kubernetes. The reason was the same: less tooling to maintain in-house.
How to present Spotify in a system design interview
- State the requirements: stream audio with low start delay, keep playlists and library data consistent per user, and collect events for personalization.
- Draw the request path through an access point to independent services.
- Put audio on a CDN and explain that the backend returns locations, not bytes.
- Add the event pipeline as an asynchronous path with a queue and a batch layer.
- Discuss the trade-off you would be asked about: per-service databases give independence but make cross-service queries hard.
For the design questions Spotify actually asks, read the top system design interview questions for Spotify. For the loop itself, read what the Spotify interview process is like.
How to Prepare
- Learn the building blocks first. CDNs, message queues, and per-service data stores each appear in the Spotify design. Grokking System Design Fundamentals covers them one at a time.
- Practice the full design under time. Grokking the System Design Interview walks through media streaming and news feed designs that share Spotify's structure.
- Study the microservice patterns by name. System Design Patterns covers the service-per-team and event-driven patterns Spotify uses.
- Know the languages Spotify works in. Read what coding language Spotify uses.

GET YOUR FREE
Coding Questions Catalog

$98

$197

$72