Performance issue with user ranking in Forums
Description
Environment
Test Plan
is related to
relates to
Activity

Sanghyun Jeon February 11, 2016 at 12:29 PM
Claremont Sakai was s also affected by this query last week and our users in the sites could not access Forums tool almost for two hours. Affected two sites are not even large sites. They have only 42 and 47 users respectively. They have a huge Forums threads, though.
Matthew Buckett November 9, 2015 at 5:17 AM
We're seeing horrific performance when MySQL selects a bad query plan and are going to try SAK-29571.
This query does get cached through, so future requests are much faster, could some of the performance problems with large site be because it's effectively overflowing the mysql query cache and so it never manages to cache the data for a whole site?

Brian Baillargeon September 29, 2015 at 2:52 PM
As a temporary fix, a sakai.property will be introduced to disable ranks for these performance concerns in two phases:
will hide the feature and prevent the findAuthoredMessageCountForStudent query from occurring in sites that do not have ranks. This means the queries will continue in any sites that already have ranks.
will disable ranks throughout the code, blocking out the query completely

Brian Baillargeon July 28, 2015 at 2:35 PM
For reference: the named query is findAuthoredMessageCountForStudent in
messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessageImpl.hbm.xml
Earle Nietzel July 21, 2015 at 9:20 AM
Yeah it does reference the exact same query, but the issue reported in that ticket is where MySQL optimizer selects a bad query plan using the MFR_MESSAGE_DELETED_I index.
If MySQL doesn't use the MFR_MESSAGE_DELETED_I index as part of the query plan then you would not be affected performance wise by this query.
Details
Assignee
Core TeamCore TeamReporter
Kyle BlytheKyle BlytheLabels
Components
Affects versions
Priority
Critical
Details
Details
Assignee

Reporter

There seems to be a significant performance bottleneck in Forums with large numbers of posts and users. This appears to be due at least in part to the ranking of each user every time a new action is taken. In our (NYU’s) instance this query turned out to be our #1 DB time consuming query:
The code looks to the correct indexes, and we measured that the query is taking about 10 milliseconds to complete (maybe more like 30 milliseconds once you factor in network latency). However, because this query runs once for each user, this time adds up significantly in sites with many users and a large number of Topics/posts.
Performance could be improved by adding an option that allows the admin to turn off ranking to or otherwise change the code to calculate user ranks in bulk.
Link to image of all page requests in Firebug: https://drive.google.com/file/d/0B_Eit0JDnaT1dk03bEFMdXkxQ2s/view?usp=sharing