NelworksNelworks

Tech / Season 1 / EP03

Spotify Streaming

Tweet coming soon
Shez

No! I forgot to download my 'Pink Season' playlist!

Shez

I can't survive a 6-hour flight with just my thoughts!

Shez

It works? But I didn't click download!

Shez

It's a miracle. God is watching over me.

Kurumi

God had nothing to do with it. It was the **LRU Cache**.

Shez

Kurumi? Are you following me?

Kurumi

Anyway, put your headphones on. Let's talk about why your phone is a digital hoarder.

Kurumi

You think Spotify is a radio. You tune in, it plays.

Kurumi

Wrong. Spotify is a **Downloader** that's just quicker than your ears.

Kurumi

There is no 'Stream'. There are only chunks.

Kurumi

A 3-minute song: dozens of small encrypted bricks.

Shez

Saving it? But I didn't pay for premium downloads on this album.

Kurumi

Doesn't matter. The app keeps a secret stash — the **Cache**.

Kurumi

Up to a gigabyte (or more) of 'junk' on your phone. Songs from yesterday. Ones you *might* play next.

Kurumi

That song you just played? You listened to it last Tuesday. It never left your phone.

Shez

Fine, that's old songs. But what if I skip to the next one?

Shez

See? Instant. How did it know?

Kurumi

Because it **Prefetches**.

Kurumi

While you're on Song A, it snags the first 15 seconds of B, C, D.

Kurumi

It reads your queue. It checks your history.

Kurumi

Bandwidth bets on what you'll need next.

Shez

So it's guessing?

Kurumi

Basically! Playlist mode? Odds you want the next track? 99%.

Kurumi

So it grabs the start of the track before you even finish this one.

Shez

But what if I choose a totally random song? I'm offline!

Shez

Aha! It failed.

Kurumi

The magic has limits. It can only predict so much.

Shez

Still, kind of genius how Spotify handled this.

Kurumi

Maybe because Spotify was built by **Ludvig Strigeus**.

Shez

Who?

Kurumi

The guy who made **uTorrent**.

Shez

Wait. The pirate guy?

Kurumi

Spotify's roots: pure peer-to-peer piracy tech.

Kurumi

In the beginning, music didn't come from servers. *Other users* shared it.

Kurumi

Neighbor has your song? Your phone nabs the chunks. Saved Spotify millions in server costs.

Kurumi

They disabled that in 2014. Switched to Google Cloud. But the architecture's bones stayed.

Kurumi

File structure? Basically a torrent.

Shez

The what?

Kurumi

Here's the **Storage Manager**.

Kurumi

Spotify UI—the nice buttons—don't care where music lives.

Kurumi

It just tells the Manager, 'I need Track 5.'

Kurumi

Manager checks his filing cabinet (Cache). If there, he hands it over.

Kurumi

If not, he rings the Warehouse (CDN).

Kurumi

That's why it works offline. UI asks for a song — Manager says 'Got it.' UI never knows you're cutoff. The disk just looks like ultra-fast WiFi.

Shez

So it's all fragments? Little encrypted bricks?

Kurumi

AES-128 encrypted chunks. You got it.

Kurumi

Can't just copy or play. Without the key, they're just bricks.

Shez

So... my phone's a digital hoarder, lies about streaming, organized by piracy code?

Kurumi

Pretty much.