

How Spotify Works - rythie
http://pansentient.com/2011/04/spotify-technology-some-stats-and-how-spotify-works/

======
stef25
"79% of server requests were for the most popular 21% of all tracks on
Spotify."

Pareto principle, bang on!

------
MarkMc
I've always been very impressed with the Spotify client - instant streaming,
quick searching, responsive UI, never crashes, near-seamless version updates,
automatic syncing. And cross-platform too! The guys that wrote it know their
stuff.

~~~
daleharvey
I was really surprised trying out the ubuntu client, I am used to very sub par
implementations on linux but it was identical

~~~
Derbasti
I am not quite sure but I think I spotted pieces of Qt in the Spotify client.
That would explain a lot of its somewhat odd behavior on OSX (wrong focus
states on some buttons, nothing serious) and its very consistent cross-
platform looks.

In Germany, its only competitor uses an AIR app. Since Spotify is not
available in Germany and thus a slight pain to use, I would really like to use
an alternative. But AIR vs. Qt... the AIR app does not work on case sensitive
file systems (solvable), it does not recognize the Mac media keys, it is
sluggish and playback is nowhere near instantaneous. And you have to install
AIR and suffer through regular AIR updates and the like. Oh, and audio quality
is noticeably worse.

~~~
bookwormAT
Well, if the competitor you're talking about is Grooveshark: AFAIK, their
adobe air client is for the most part a legacy application. Grooveshark used
to be all flash in the past, so they made the desktop app with AIR.

They seem to invest all their effort into the (very good) HTML(5) client and
into mobile apps now.

~~~
jannes
I think he was talking about Simfy.

<http://en.wikipedia.org/wiki/Simfy>

------
huhtenberg
Since it's p2p and it's TCP-based, I wonder if they do TCP hole punching for
NAT'ed peers - not that this is hard to do [1], but it is far less common than
UDP hole punching.

[1] Just need to predict the Internet-facing ports for both peers and then
instruct them to connect() towards each other at these ports. The rest is
handled natively by TCP, via the _simultaneous open_ scenario [2].

[2] <http://www.ietf.org/rfc/rfc793.txt>, sect. 3.4, fig. 8

~~~
vektor
They don't do any NAT traversal, but that use UPnP to open ports. During a
talk Gunnar Kreitz said that they still got a 60% success rate for connections
(if I remember correct, varied between countries also). And that this was good
enough for them. More can be read in this paper:
[http://www.csc.kth.se/~gkreitz/spotify-p2p11/spotify-p2p11.p...](http://www.csc.kth.se/~gkreitz/spotify-p2p11/spotify-p2p11.pdf)

~~~
tjoff
Since I'm NATing my network and don't allow UPnP the statement that they don't
do any NAT traversal seemed suspicious since I know spotify does stream to
other peers from my machine (400 MB since last reboot (13 days)).

Got the answer from the paper: _When a client wishes to connect to a peer, a
request is also forwarded through the Spotify server asking the connectee to
attempt a TCP connection back to the connecter. This means that as long as one
of the two peers can accept incoming connections, the connection will
succeed._

------
sudonim
One of the reasons I canceled my spotify subscription is that I learned I was
participating in a p2p network without my knowledge. If I'm paying for it, I
don't want to be a node in their network. Most users are probably clueless
about that because they aren't up front at all.

~~~
eps
> _If I'm paying for it, I don't want to be a node in their network._

You are paying for music licensing and you get the delivery for free because
of the p2p nature of their system. Traditional client-server delivery would've
simply translated into higher monthly fees, which I am pretty sure would've
not been any more popular among their average user base.

~~~
nhangen
Perhaps, but I agree they should be more up front about the way they use
bandwidth.

------
nollkoll
the star coder of spotify. the guy behind their p2p is ludvig. creator of
µTorrent. in many ways a remarkable engineer. only in swedish.

[http://chalmersalumni.files.wordpress.com/2011/09/ludvig_str...](http://chalmersalumni.files.wordpress.com/2011/09/ludvig_strigeus_fkraft_2011.pdf)

~~~
lucaspiller
He was also the guy who originally reverse-engineered Transport Tycoon Deluxe
which led to OpenTTD. :)

------
EwanToo
Site seems a bit unreliable to me, timing out, so here's the original research
PDFs that the article is based on

<http://www.csc.kth.se/~gkreitz/spotify-p2p10/>

------
mzl
There is a newer paper than the one described in the linked article available
(<http://www.csc.kth.se/~gkreitz/spotify-p2p11/>) that has some interesting
measurements on the network.

------
cshesse
How much bandwidth are they saving by making a P2P network? I made up some
numbers and got about 30k$ a month at S3 prices, is that worth building and
maintaining this P2P network instead of just a bunch of servers?

~~~
eurleif
Even if it's only $30k/month now, P2P is infinitely scalable for (essentially)
free. That's pretty valuable

------
adaml_623
"Only 8.8% of music playback comes from Spotify’s servers. The rest comes from
the peer-to-peer network (35.8%) or your local cache (55.4%). The exception
here is Spotify on smartphones, which gets all the music directly from the
Spotify servers."

That point about doesn't quite make sense. Most of the time on my phone I'm
playing from the local cache in off line mode. So it all comes from the
servers originally but 98% of it is repeated plays from the local cache.

~~~
estel
There's a distinction between songs which are from playlists explicitly
"available offline" and songs in Spotify's cache. Presumably the mobile
version doesn't have a cache for non-downloaded songs.

~~~
bookwormAT
I think the Android version does have a cache beside the offline playlists. At
least there is an option to set the size in settings.

------
speedracr
500 Internal Server Error. Google Cache:
[http://webcache.googleusercontent.com/search?hl=de&sourc...](http://webcache.googleusercontent.com/search?hl=de&source=hp&q=cache%3Apansentient.com%2F2011%2F04%2Fspotify-
technology-some-stats-and-how-spotify-works%2F&meta=&aq=f&oq=)

------
SuperChihuahua
One should also discuss their revenue streams. Here in Sweden, we pay 99 SEK
(about 14USD) each month, and I learned yesterday that the artists only get 5
SEK from that 99 SEK. 60 SEK goes to the record companies...

Source (in Swedish so please use translate): [http://jardenberg.se/b/lite-mer-
spotify-siffror-hur-99-krono...](http://jardenberg.se/b/lite-mer-spotify-
siffror-hur-99-kronor-blir-en-femma/)

~~~
estel
That's just how the record companies work.

There was an interesting breakdown from the CEO of Mog discussed his revenue
model on this pretty good Fast Company article:
[http://www.fastcompany.com/1796382/mog-ceo-on-artist-
payment...](http://www.fastcompany.com/1796382/mog-ceo-on-artist-payments-its-
like-a-black-hole)

~~~
mbesto
Which is why their business model is now flawed. If you look at what a music
publisher actually does. From wikipedia:

 _"In the music industry, a music publisher (or publishing company) is
responsible for ensuring the songwriters and composers receive payment when
their compositions are used commercially. Through an agreement called a
publishing contract, a songwriter or composer "assigns" the copyright of their
composition to a publishing company. In return, the company licenses
compositions, helps monitor where compositions are used, collects royalties
and distributes them to the composers. They also secure commissions for music
and promote existing compositions to recording artists, film and television."_
[1]

So basically the publisher is getting money (a large portion of it) to make
sure they get paid and provide contract negotiations. Spotify can easily (1)
ensure the artist gets paid and (2) provide negotiations (you get X for Y
amount of plays). The excessive overhead of the middle man is unnecessary now.
IMHO, recording labels should just provide artists access to
studios/producers/etc and become glorified marketing (music specific) firms.
Also it might still be interesting for publishers to collect royalties for
things like tv-ads, inclusion to movies, etc. But to the mass public it's a
service that's no longer needed.

Lots of business models are built on assumptions. The assumptions have
changed.

[1]- <http://en.wikipedia.org/wiki/Music_publisher_(popular_music)>

~~~
mikeknoop
I've thought about this. We aren't really getting rid of middle men. Rather,
if what you proposes runs its course, we are shifting the middle man from old
media distributors to... new media (internet) distributors.

What's to say streaming services wouldn't run up the price on artists once
record labels are out of the picture? You could argue that artists could
simply take their music to another service but if one service has A LOT of
users (ie, Spotify) that might not be a viable option.

~~~
jakubw
Because streaming services wouldn't own rights to artists' work and they
wouldn't be tying them down with multirecord deals. With these constraints
lifted, there'd only be free market mechanisms left, which would force the
services to be nice both to artists and users.

~~~
danieldk
Or spread artists amongst competitive services, forcing us users to subscribe
to multiple services.

I'd rather take a copy of the music, and own the copy the rest of my life,
thank you.

------
kkolev
Seeing this link on HN reminded me to give Spotify a try. Going to their
website reminded me that they don't provide a non-Facebook option. That's a
shame.

------
mcao
Doesn't matter how amazing their technology is when they leave critical bugs
in the client unresolved for over 2 years:
[http://getsatisfaction.com/spotify/topics/error_message_offl...](http://getsatisfaction.com/spotify/topics/error_message_offline_access_for_this_computer_device_has_been_withdrawn)

------
esmevane
A curious bit about the P2P stuff - although it's clever as can be, it makes
bootstrapping on lighter network hardware excruciating. Such a shame.

------
zbowling
All this technology and Rdio is still growing faster around these parts. Guess
amazing technology doesn't always help you win the game.

~~~
megaman821
I choose Rdio over Spotify because it has a web client which probably means
they couldn't leverage p2p even if they wanted to (without using a browser
plugin).

~~~
eps
Is there any Flash involved? One of the biggest features in Flash 10 was the
addition of p2p streaming.

~~~
chrischen
Upgrading flash does ask me to close Spotify.

------
dhruvbird
very insightful. esp. the bit about how they use a combination of server based
and p2p based streaming to ensure a seamless experience.

