We have had a recurring problem on our Discourse forum for a while and we finally managed to narrow it down and reliably recreate it.
Here are the steps to recreate:
-
Have a topic with thousands of replies
-
Bookmark a post in that topic
-
Open the topic
The topic now takes a long time to load. In some cases it times out and we get an Ngnix error instead (502 Bad Gateway).
Here are some approximate loading times from our forum:
-
For a topic with about 1,000 replies, the extra loading time is a few seconds after a bookmark is created. Noticeable but not a huge problem.
-
For a topic with about 4,000 replies the loading time is usually 20-30 seconds and it sometimes times out instead of successfully loading the page.
-
For a topic with 9,000+ replies, it times out most of the time. In some cases it loads, but only after 30+ seconds.
Note that these topics load without any problem if we have no bookmarks in them. The problem only occurs for users who have bookmarks in a particular topic and as soon as they remove the bookmark the topic loads normally again.