โ† Back to All Questions
Medium~50 minStreaming & Video

Design Spotify - Music Streaming Service

SpotifyAppleAmazonSoundCloudDeezer

๐Ÿ“ Problem Description

Design a music streaming service like Spotify. Users can search and play songs, create playlists, follow artists, and get personalized recommendations. Handle audio streaming, content delivery, and offline mode.

๐Ÿ‘ค Use Cases

1.
User wants to searches for a song so that sees search results
2.
User wants to plays a song so that audio streams with low latency
3.
User wants to creates playlist so that playlist saved and shareable
4.
User wants to downloads for offline so that can play without internet

โœ… Functional Requirements

  • โ€ขSearch songs, albums, artists, playlists
  • โ€ขStream audio with quality selection
  • โ€ขCreate and share playlists
  • โ€ขFollow artists and users
  • โ€ขPersonalized recommendations
  • โ€ขOffline playback
  • โ€ขCross-device sync

โšก Non-Functional Requirements

  • โ€ขPlayback start < 200ms
  • โ€ขNo buffering during playback
  • โ€ขSupport 100M concurrent users
  • โ€ข99.99% availability

โš ๏ธ Constraints & Assumptions

  • โ€ขAudio licensing requirements
  • โ€ขMultiple audio qualities (128, 256, 320 kbps)
  • โ€ขLimited offline storage on devices

๐Ÿ“Š Capacity Estimation

๐Ÿ‘ฅ Users
500M users, 100M concurrent streams
๐Ÿ’พ Storage
100PB (50M songs ร— 3 qualities)
โšก QPS
Play: 100K/sec, Search: 50K/sec
๐ŸŒ Bandwidth
10Pbps peak
๐Ÿ“ Assumptions
  • โ€ข 50M songs
  • โ€ข 3 quality versions per song
  • โ€ข Average song: 5MB (320kbps)
  • โ€ข 100M concurrent streams

๐Ÿ’ก Key Concepts

CRITICAL
Adaptive Bitrate Streaming
Adjust quality based on network conditions.
CRITICAL
CDN for Audio
Edge caching reduces latency and origin load.
HIGH
Pre-buffering
Buffer next song in playlist for gapless playback.
HIGH
Collaborative Filtering
Recommendations based on similar users.

๐Ÿ’ก Interview Tips

  • ๐Ÿ’กStart with the audio streaming architecture
  • ๐Ÿ’กDiscuss the recommendation system in detail
  • ๐Ÿ’กEmphasize CDN usage for audio delivery
  • ๐Ÿ’กBe prepared to discuss royalty tracking and licensing
  • ๐Ÿ’กKnow the difference between streaming and downloading
  • ๐Ÿ’กUnderstand the catalog management and metadata