Logs/Activity Report performance

Logs/Activity Report performance

by Eric Merrill -
Number of replies: 2
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
I've opened a ticket, MDL-11901 about this:

Activity reports are of course generally slow, and tend to run some very SQL selects. While these are selects are happening, of course no inserts can occur. This blocks essentially all traffic on the site (since almost any page view/action includes a log write).

This directly relates to the count of log rows you have. In our case we pruned it as much as we could, and were left with 10M+ entries (we have to keep at least 2 semesters, worth of logs), so each select may take 5-15s, which really cripples the site.

The fix that we implemented is to have 2 tables. One,'log', and one 'log_insert'. We modified the add_to_log in datalib.php to write to 'log_insert' instead of 'log'. Every cron cycle a piece of code run that moves log entries from 'log_insert' to 'log'.


Martin D. mentioned that logs were one of the things he isn't very happy with the general implementation of, so maybe there needs to be a bigger discussion of it.

Discuss!!

smile
Average of ratings: -
In reply to Eric Merrill

Re: Logs/Activity Report performance

by Oksana Delgado -
Hi Eric,

Do you know if there is any development of this issue?
Tracker has Fix Version/s: 2.0


Thnx,
Oksana
In reply to Oksana Delgado

Re: Logs/Activity Report performance

by Ângelo Rigo -
Instead of one big log table, it could balance the server load having many log tables, one for every module. So the log table would not grown too much.