audiobookshelf
audiobookshelf copied to clipboard
[Bug]: Slow loading playlists
Describe the issue
Playlists are taking 15+ seconds to load. This occurs when selecting the playlists tab to view the list of playlists and when clicking the button to add a podcast episode a playlist (both loading the list of playlist and after adding the episode to a playlist). I am seeing this when connecting to the web app from a desktop and from the mobile app with even just a single playlist created.
I tested v2.7.2 and v.2.8.1 and have the issue with both versions. The podcast library does not have this slow loading issue. I reverted to v.2.3.3 which does not have this issue; playlists load almost instantly.
Steps to reproduce the issue
- Audiobookshelf installed on docker (podcast and audiobook volumes on network share, config and metadata volumes local on SSD)
- Click the "Your Playlists" button on a podcast episode or click the playlists tab
Audiobookshelf version
2.8.1
How are you running audiobookshelf?
Docker
Roughly how many playlists do you have and how big are they? Just rough estimates so I can simulate it.
This was about 6 playlists, all with one or two episodes except the one I was intentionally trying to load that had about 30 episodes. It was painful enough that I stopped at that point.
About how many podcasts and podcast episodes do you have? I just added podcast episodes to a playlist and didn't notice a slowdown between adding the first episode and the 10th episode using the Android app using server version 2.8.0
I have 14 podcasts with ~850 episodes total (pretty even spread, largest podcast has 200 episodes)
I have 14 podcasts with 3800 episodes total. The largest three podcasts have 500-1000 episodes and the rest are under 200. There is no slowdown in loading the library itself or individual podcasts, only playlists.
Having the same issue with playlists and collections. My Audio files are also located on a network drive, metadata stored centralized locally on SSD. Listing playlists/collections is very slow: ~10-30 sec.
Time to load the list of playlists/collections is increasing by the amount of books related, but takes overly long initially with only very few collections/books.
I reviewed the code - it seems to load all related books to display the list of playlists/collections. Maybe it's a good idea to just load the first n (2?) books, for each collection, that are needed to display the covers. Or giving a switch in the settings to disable dynamic cover display in the list of playlists/collections for increased performance?
Roughly 10 collections, each having 5-60 books related.
Having only 1 playlist with 100 books takes evenly long as the collections.
I'm investigating this as well.
The primary issue seems to be that when you're loading the list of playlists, it includes all items in all playlists, rather than merely enough to render the thumbnail for each playlist.
So when you have a 4 playlists of 100 items each, it has to send all the information for 400 books.
While we obviously need to get the entire playlist when we're looking at a single playlist, I don't think there's much of a reason to send back every entire playlist when we're just looking at the list of the playlists.
I'm going to see if there's a simple modification to the server code to just send back upto first 4 books of each playlist.
On my library with collections and playlists, #3015 fixes the issue, though I don't know the entire code base well enough to be able to tell if it breaks something somewhere else. Needs review and testing.
Updated in v2.10.1
There are still improvements that can be made but they may wait until playlists are switched to the new data model.