Hello all,
Apologies if this isn’t the right place, but I have moved instances a few times, and in doing so I’ve accumulated a number of subscriptions from my old instances. I always used the “migrate” feature, and I have roughly 200 communities I’m subscribed to. Most are from various other instances that aren’t my own. That being said, I have Lemmy open on “subscribed” and “scaled”, as I found this gives me just what I want to see when I boot up the site.
But it is very slow, sometimes even timing out on Jerboa. I thought it was my instance, but I’ve had this issue on other instances as well. I’d imagine federating all my subscriptions would take some time, but then wouldn’t “All” cause even more problems? I’ve tried to look into this to no avail.
Am I the only one? I’m asking this more out of curiosity than an actual solution.
Aside from general issues others have mentioned, our instance (slrpnk.net) is seeing some especially high database load in the last couple of days and I also noticed the subscribed page to be even slower than usual. I tried to figure out what it causing it, but so far there is no clear smoking gun, but I suspect some AI scrapers found a way to target the Lemmy API directly so our current scraper protections for the webinterface are inadequate.
What you can try is to clear your browser cache for the main domain. In the past there was a bug in Lemmy that caused Firefox based browsers to accumulate many gigabytes of cache data and that slowed down the loading of the page significantly. In the latest version there are some fixes for this and it shouldn’t effect app usage, but I suspect this problem still persists to some extend.
This is pretty much always going to be the case because the database query is much more complicated to filter by your subscriptions rather than the completely unfiltered views that are just sorted a certain way.
I don’t have direct experience working in the lemmy codebase, but I do in piefed, and this is just an inherent limitation of how databases work. Basically, there is a big table in the db with all the posts that the instance knows about. As an example, let’s say that you want to look at your Subscribed feed and sort it by New. First, the database sorts all the posts by newest first (this step is very quick). Then it will filter out all the entries that are not in a community that you are subscribed to (this step is a lot slower). So, views where the database doesn’t need to do that filtering step are a lot faster than others. There are other things that slow down queries as well like blocks or keyword filters.
Smarter admins than I can employ strategies to tune their database for better performance. I don’t have any knowledge in this area though, so others would be able to provide more insightful answers.
Interesting. So when you query subscriptions, it actually queries everything and then filters it.
I decided to look at the github for Lemmy and found this issue that seems to reflect what youre saying.
I’m having flashbacks of avoiding table scans during my internship. 🙂
Lemmy’s databse schema was updated for 1.0. I hope that will address many of the performance problems. It’s due to release soonish. The beta is just around the corner.
It also further links to another issue about individually blocking users and communities. Apparently that is quite inefficient in the current version, so maybe that adds to your problem?
Strictly speaking, the db might be looking in an index to choose rows by the communities — but using such a condition is pretty much guaranteed to be slower than not using it, anyway.
The actual answer depends on the actual database organization, of course. Ideally the whole database should be organized around frequent queries.
Just wanted to add “for me too”. Sometimes my app takes a few minutes to load/time out the “subscribed” feed, while the “all” feed works fine and even my notification page has no issues.
To add to other answers, the result for the ‘all’ feed is likely to be cached, either explicitly by the server app or implicitly by the database. Personal feeds are less likely to be cached, since they’re only used by individual users.
This is probably true for anonymous (not logged in) users, but might not be if you are logged in. Things like user/community/instance blocks, votes, read/unread status, etc. need to be accounted for when generating the main feed for logged in users, and those are dynamic. It might be cached for some time, but the retention time would likely be short (a couple minutes maybe).
I haven’t worked too much with the caching that piefed does, but I know it keeps some info in a redis cache to help speed things up (blocks, votes, etc.). That way getting all that info doesn’t need to be a new db query every time except maybe the first time. Some pages also make use of etags so that if the content is unchanged, the request doesn’t need to hit the db at all. I imagine lemmy has some mechanisms to do caching as well, but I am unfamiliar with the code at that level.
It’s likely much faster to fetch the common feed from the database cache or prepared cache like Redis, and apply all this additional data in the app, than do uncached joins. So I’d hope that the apps do this. Especially since you say they use Redis, which of course doesn’t do joins and such, unless something changed in the past years.
I’ve noticed the more subscriptions I add, the slower my feed loads. All does seem to load faster for me as well.
Happens to me too. Jerboa frequently times out as well. I thought it was because my access point is running on potato hardware, but i guess it’s a thing other places too.
Every instance is like this it seems, maybe lemmy doesn’t make a batched select at the cache and the db, but idk.
Maybe a new
webscalebackend could solve this, but i’m just a java backend developer, not a rust one. Maybe could be an interesting project, scala + pulsar + batching, turning lemmy into a microservices hellscape.Edit: but
Same, thought it was just me or my instance (feddit.nl), started after some update. Unsubscribed from a lot of communities and switching to limit posts per page helped a bit. Te-subscribing made it somewhat worse again. IIRC it is some instances or communities specifically.
If you remember which instances are the worst, please let me know. I still get time-outs more often than I’d like… Though it has become less after the server upgrade Ted did.
If I remember,or figure out which ones, I’ll let you know, thanks!
I don’t see a noticeable slowness on lemmy.ca with Subscribed+Scaled. That said it could be I don’t have enough subs.









