...
Caching in effect. Below are sequential attempt at accessing a forums heavy course course-v1:IDBx+IDB6x+2015_T2 where the comment count of the pinned posts are ~4000. Each of the 20 threads it is trying to load (limit=20), is taking too long for a query. After each refresh, more data gets cached and then the comment count for the next threads are fetched. After a few refreshes, this course will no longer show 500s and load.
Looks like it is trying to retrieve the count of all comments with with the matching comment_thread_id in order to get the comment_count. This is horribly inefficient.
...