Page 1 of 1

Caching system for artists list ?

PostPosted: Sat Feb 07, 2009 4:24 pm
by Matts
Hello !

My Subsonic is running on an old computer (Athlon 700Mhz, 512Mb of RAM) and as I have a noticeable amount of artists in my collection, displaying the artists list takes about 15 seconds...

It's not that annoying, considering the fact that the artists list is on a frame, and thus is loaded only once, when I open subsonic, but still...

I was wondering if it would be possible to have a caching system for the artist list, updated daily ?

This way, loading subsonic would be instantaneous...

PostPosted: Sun Feb 08, 2009 6:20 am
by sindre_mehus

This is already cached. Given that you don't restart Subsonic, and don't modify the (timestamp of the) music folder(s), Subsonic will not read from disk when creating the artist list.

Also, is supports HTTP "last-modified" to facilitate browser caching.


Multiple music folder problem

PostPosted: Thu Mar 05, 2009 10:26 pm
by kdid
Using your excellent software I just discovered a related problem. If you have multiple music folders for Subsonic and you switch between them using the dropdown box at the top of the artist list, then it looks like Subsonic will generate a new artist list from scratch. When doing that it also looks like it is accessing the file structure on disk instead of using a internal cache for the artists that is in each list.

Normally this is not a big problem, it is noticable, but only barely.

But if you have the files on a different machine, so that it need to access the filestructure over the local network, then going between folders in the said dropdown list becomes painfully slow.

I have a setup at home now with Subsonic on one PC and all the music files is on that same PC. Going between music folders there is quite snappy.

In addition I installed Subsonic on a different PC. This PC is accessing the music files over the local network at the machine mentioned above. Going between music folders on this machine is painfully slow. To get up the full artist list takes over a minute. And if you pick another folder in the dropdown list, it takes less time since there is less folders to scan. But if you again go back to the full artist list, then it again takes a long time. When I tested it now it did it in 45 seconds.

The important part here is that each of these folders should had a cached list of artists, and that the cache should had been made when Subsonic did start and then should had been maintained as you describe above throught timestamp notification.

Without a fix for this, you will have serious problems by having the music files on a NAS and running Subsonic on a different machine.

I will send you a PM with login info on my two instances of Subsonic so that you can get a feel of what I'm talk about.

EDIT. But a good workaround for me for now is to keep the music on the same machine as Subsonic. This time I was merely testing how such a setup would work.

As always, I'm greateful for the effort you put into Subsonic. Keep up the good work.

PostPosted: Sun Mar 08, 2009 8:32 am
by sindre_mehus

Thanks for your extensive report and for giving me access to your server which so clearly demonstrates the problem.

I hope to get time to look deeper into this in the coming week.


PostPosted: Sat Mar 14, 2009 8:45 pm
by sindre_mehus
Good news!

I spent a whole day optimizing this, and it should be pretty good now.

First of all, browser caching is a lot better, meaning that the artist list in most cases doesn't even have to be transmitted. It will only be sent if one of the following is true:

o It's not in the browser cache.
o The selected music folder has changed on disk.
o Certain settings have changed (such as theme, language, music folder definitions, internet radio settings).

Secondly, the artist list is also cached server-side. This cache is even persisted, and will survive server restarts.

Starting from Subsonic 3.7, this should hopefully eliminate a lot of disk traffic.

One potential optimization I haven't done is pre-populating the cache at start-up and/or at regular intervals.

PostPosted: Mon Mar 16, 2009 3:43 pm
by aphuey
Awesome improvement! Thanks for all your work, Sindre!

PostPosted: Wed Mar 25, 2009 11:01 pm
by zeekay
Wow, that sounds great sindre, any news on when the new beta will drop?

PostPosted: Mon Mar 30, 2009 10:26 am
by kdid
Thanks Sindre. This sounds like it will really speed up browsing. I look forward to 3.7. :-)

Do you know if this also will work if you use UNC paths to the music folders?

PostPosted: Mon Mar 30, 2009 10:40 am
by sindre_mehus
kdid wrote:Do you know if this also will work if you use UNC paths to the music folders?

I haven't tested that, but as long as the last modified timestamp is correct for those folders, it should work just fine.

PostPosted: Tue Apr 07, 2009 12:21 pm
by mason
nice to hear, since im hitting the same problems with a hughe filebase!

im really glad i found your app and if i finaly decide to use it ... you will get one more happy donor on your side :)