Spotify
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many play starts a second at the evening peak?

      How much audio does the network carry at peak?

        How much storage does every format of every track take?

          How many events a second must the play pipeline absorb?

            Build-up · 6 steps

            Build the high-level design

            One functional requirement at a time, ending with a design that works end to end before it is fast, correct and safe.

            Step 1 of 6

            Search the catalogue

            Ingestion encodes and encrypts label masters into the audio origin and writes rights to the catalogue. CDC feeds an indexer, so search never reads the database on the hot path, and every query is filtered by market.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “People skip songs constantly, and every tap must start in under 250 ms at p50. How do you get there?”

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “A listener’s train connection keeps changing speed. Which formats do you store, and how does quality adapt?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “Royalties are split by stream counts. How do you count plays, including offline ones, accurately enough to pay?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “Premium listeners download playlists before nine days without signal. How do the files stay licensed with no network at play time?”

              Your move. Pick an approach:

            5. Deep dive 5 of 6

              Interviewer

              “Friends co-edit a trip playlist, sometimes inserting at the same spot at the same moment. How do you store the order?”

              Your move. Pick an approach:

            Build-up · 7 steps

            Follow one Mumbai evening through it

            Three planes. The only per-play calls to our servers are one small playback request and a batched event upload; the megabytes come from the CDN or the device.

            Step 1 of 7

            Search

            She types “tum hi”. The search service normalises and transliterates it, retrieves candidates with market = IN, re-ranks by popularity and her taste, and hydrates the top 10 from a cache in front of the catalogue.