profile pages are slow for users with lots of posts
In prod, I've noticed that loading some user profiles is quite slow -- on Meta I'm seeing times of 8 to 12 seconds for some and around 4-5 seconds for several more. One thing the slower ones have in common is that they have lots of posts. To test that theory, I tried some of those same profiles on other communities, where they had sub-second load times.
The profile page shows the top 15 posts, which I assume is being checked in real time. (It would be frustrating for users if that were stale.) Can we take a look at that query? We had problems with slow loads on the tags page that were caused by N+1 errors; I don't know if this is that, but it's something to check. (If I knew how, I would have done that before filing this issue, sorry.)
I tried replicating this in a dev environment, but dev environments don't have enough data to trigger it.
Might be worth looking at the "Posts by user" page at the same time, as it may be slow for the same underlying reason (whatever that turns out to be). Using my Meta profile as an example with many posts (currently 364), the following all take several seconds to load for me:
- https://meta.codidact.com/users/53890
- https://meta.codidact.com/users/53890/posts
- https://meta.codidact.com/users/53890/posts?sort=activity
- https://meta.codidact.com/users/53890/posts?sort=age
- https://meta.codidact.com/users/53890/posts?sort=score