Hacker News new | past | comments | ask | show | jobs | submit login
How Spotify Works (pansentient.com)
162 points by rythie on Nov 25, 2011 | hide | past | favorite | 51 comments



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

Pareto principle, bang on!


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.


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


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.


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.


I think he was talking about Simfy.

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


It's fine.. If you use pulseaudio, if you hate pulseaudio's latency and have falled back to alsa then suddenly the volume control doesn't work.

Luckily the windows version works fine under Wine , even though it does nag about "unsupported platform"


I find when I try to share songs with friends via the linux client, my friends never have the songs in their inboxes. But when I send the same songs via the windows client, they show up with no problems.


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.


> 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.


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


Rhapsody, Rdio, etc. all do client-server and cost the same.


Seems a minor point to me, the monthly fee is relatively small. For example I would happily pay the same fee if instead of them providing the application they just gave me the right to download anything from their catalog from bittorrent sites.

Your upload bandwidth is more limited than down though (although how much does the average user really use upstream anyway?).

It should be easy to use a firewall to throttle the outbound traffic on whatever port spotify uses. Pherhaps you could just block it altogether , does the service still work even if you are not sharing?

I wonder what the legal implications of this are though, could the RIAA or similar at some point decide to start suing individual spotify users for sharing their music even though the record companies have some agreement with spotify in place?


Why does it matter?


Because most home connections are asymmetrical, and even a small amount of upstream bandwidth usage can degrade the performance of everything else.


I seem to remember reading that the speed is of your connection is tested, and the amount of data sent is customized not to slow your connection down.


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


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...


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.


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...


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


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/


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.


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?


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


"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.


I'm assuming they mean, of the actual bits that have ever been downloaded, where does it come from?


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.


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.


500 Internal Server Error. Google Cache: http://webcache.googleusercontent.com/search?hl=de&sourc...


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.


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...


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...


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)


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.


I thought the main advantage of the record companies was that they could loan artists large amounts of money to make and market a commercial record.

Most musicians I know are poor and would make pretty poor business people. Unless spotify or apple decide to go into developing artists themselves.


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.


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.


Just like Amazon are doing to publishers. Middle men are getting disintermediated left right and centre.


And that's why the record companies are in a downward spiral, and why they are fighting so hard against online markets for recorded music.


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...


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.


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


As for me, I switched from the French competitor Deezer to Spotify in a heartbeat, when Spotify's client totally blew my expectations with zero latency.

So I guess it does help you win the game. But of course it's not the only factor.


I guess you're in the US, Canada or Brazil, because Rdio isn't available anywhere else. But Spotify is, and is doing well.


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).


That's interesting. One of the main reasons I use* Spotify is because it has a native client and not a web interface.

*I'm actually currently in a period when I listen to music which is likely to never show up at any professional music service, but when I feel the need for mainstream music again, Spotify will probably be my choice for several reasons including the above, despite their recent Facebook-login only policy (which doesn't affect me, but still bothers me a bit).


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


Upgrading flash does ask me to close Spotify.


P2P in Chrome is around the corner: http://www.webrtc.org


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: