Issue Details (XML | Word | Printable)

Key: MDL-11901
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Martin Dougiamas
Reporter: Eric Merrill
Votes: 4
Watchers: 6
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Improve performance of log table

Created: 25/Oct/07 12:26 AM   Updated: 12/Mar/09 11:07 AM
Return to search
Component/s: Other, Performance
Affects Version/s: 1.5.3, 1.8.3, 1.9
Fix Version/s: 2.0

Database: Any, MySQL
Participants: Eric Merrill, Martin Dougiamas and Samuli Karevaara
Security Level: None
Affected Branches: MOODLE_15_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
There is somewhat of a performance bug in the way logs/activity reports are handled.

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.

Ill post our patch code when I get back to the states, but it's pretty basic.


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas made changes - 12/Mar/09 11:07 AM
Field Original Value New Value
Summary Logs/Activity Reports cause serious performance block Improve performance of log table
Fix Version/s 2.0 [ 10122 ]