How to monitor Spotify resource usage on Windows
Spotify is a popular music service that is available as a web version, desktop clients and as applications for various platforms.
Some Spotify users noticed back in June that the client was causing excessive writes on the disk. While the reported write amount varies a lot, some stated that they were seeing 10Gb/hour writes on their computer by Spotify alone.
Update: Spotify has released a new client version that addresses the issue according to the update history. Updating the desktop client to version 1.0.42 should fix the amount of written data. Feedback from users suggest that the situation has improved but not been resolved completely. End
What's particularly interesting about this is that the writes occur even if Spotify is kept open in the background but not playing any songs.
If you do some math, you will realize that those writes cannot be explained by song caching even if the highest song quality is used.
Users who notice the behavior are worried that Spotify alone may cause their computer's Solid State Drives to die early due to the excessive number of writes.
Not all Spotify users are affected by the issue. I let Spotify Free run on a test system for some time and noticed no excessive writes at all.
If you are using Spotify, first thing you may want to do therefore is to monitor the resource usage of the client to find out if the version of Spotify running on your device is writing excessively to the drive.
While you can use a lot of tools to monitor writes on a system, I suggest you simply start by looking at what the Windows Task Manager reports (or the excellent Process Explorer).
- Hit Ctrl-Shift-Esc to launch it.
- Switch to processes or details depending on which version of Windows you are using afterwards.
- Locate the spotify.exe process or processes, and check their I/O write bytes.
- You may need to add the data to the table by right-clicking on a table header and selecting "select columns".
Note that the data is bytes which means that you need to convert it to Gigabyte first. You can use this tool for that. Basically, 1000000000 bytes are roughly 0.931 Gigabyte. So, if you see something like 2.3 million bytes like on the screenshot above, that is just about 2 Megabyte of data.
What if Spotify causes excessive writes?
Spotify users who analyzed the issue found out that the writes cannot be linked to song caching but affect certain database files in the Spotify folder: mercury.db and mercury.db-wal in the root Spotify folder.
So, what appears to happen is that Spotify runs the vacuum command on the database aggressively which causes the writes. Vacuum optimizes the database file by reclaiming space using various optimization routines. This process creates a temp database file that replaces the original file after the command ran its course.
Spotify users have a couple of options to deal with the issue.
- Use the Web Client and not a desktop client. This is by far the easiest option but it may not be convenient.
- Move the cache files to a RAM disk, or another drive (not SSD if possible). Ram disk uses system memory as a temporary disk which would mean that Spotify would write to RAM instead of the actual hard drive.
- Edit the Spotify binary and replace the VACCUM command with blanks. Note that this has not been tested on Windows, but it seems to work fine on Mac OS X. Two issues arise from this: first, you have to redo the process after each update. Second, the database file may get slower over time since it is never vacuumed.
Now You: Are you noticing excessive writes when running Spotify?
Or on Mac just open Activity Monitor and switch to the disk tab.
Also I found this temporary fix for both platforms yesterday on Hacker news: https://news.ycombinator.com/item?id=12914188
The fix is a little way down the page for both platforms and some suggested ways of doing it.
On OS X, Open /Applications/Spotify.app/Contents/MacOS/Spotify in a hex editor.
Search for “VACUUM;” Replace with “xxxxxx;”
On Windows, apparently the key “VACUUM;” string is in libcef.dll but I don’t have a Windows system to see if editing it the same way provides a workaround like on OS X.
I used hexcurse from homebrew. After opening the file hit tab once to switch to the ASCII side, Control-F to search for VACUUM;, then type “x” six times to overwrite each character. Quit and save.
So it’s bad if i have already over 600.000.000 I/O Write Bytes after 4 songs? It’s rising with about 1.000.000 every ~10 seconds.
Well that is a lot (572 Megabyte). Seems you are affected by this ;)
I just read that v1.0.42, released a few hours ago, has this fixed. Waiting for the roll out and I’ll comment again.
Another way to see this easier:
in Process Explorer select View -> Select Columns -> Process I/O tab -> check Read Bytes and Write Bytes.
This will make the MB/GB of activity show up in its own column all calculated for you. Mine is doing about a GB per hour :(
it seems like an error in the way the application is using SQLite from the previous post I linked.
Yes very good tip, Martin should update the article…
After v1.0.42 update, i have 200+ MB with 6 or 7 songs. http://i.imgur.com/Olzrjuk.png
Is growing faster to about 150MB at program startup and then it’s growing with 0.1MB/s when the music plays, not when it’s on pause. And with 0.7MB/s at every audio commercial. This is what, 6MB/minute for 128kbps audio (free user)?
why use spotify in first place??? annoying audio ads eacg 5 songs and ads on your screen… I prefer soundcloud 1 million times above spotify. ok, the paid version ins’t that expensive, but why even pay if soundcloud is spotify premium made free? ofc they have their purposes, for example, soundcloud is to find new music producers, it’s full of independant producers (like shwann, RudeLies, etc) that make AWESOME music, available legally for free (yeah, they work and let you download their music for free), while spotify is more to find trend music, popular music.
to be honest, I used to use piracy – a lot – to download songs. since I started to use soundcloud, found independant music producers, pretty much 90% of all my music collection is made of free – and legal – songs. I am also not aware of, but soundcloud supports downloading the song natively – as long as the producer ticks the box and inserts a link for it. does even spotify does this? afaik, you need to pay to even post your song into the spotify world, while on soundcloud it’s 100% free and you even get known and probably paid for it… this is why most independant producers are on soundcloud and not on spotify.
i know this reply runs a bit from the subject, but makes me a bit mad knowing that people pay for spotify when they have such an awesome service like soundcloud or even last.fm out there, completely free… just my opinion, ofc, each is free to use whatever one’s want.
What a coincidence – about 2 hrs ago I installed the desktop version to access the latest Cohen album (love it;) and listened to it maybe twice while using the PC. Then worked through unread emails and the Spotify article caught my attention. Checked the read bytes and the number was already over 12 000 000 000 and the other number steadily going up… No good and no peace of mind, so I ended all spotify processes and deinstalled it. So glad about your posts, much appreciated! Off now to check out soundcloud… J