Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0.3, 3.5.1
-
MySQL
-
MOODLE_30_STABLE, MOODLE_35_STABLE
-
MOODLE_36_STABLE
-
MDL-54035-lazy_reload -
Description
There is a big performance drop due to inefficient indexing of mdl_cache_flags table.
This table can grow big if there is a lot of users (eg. 200k+) and bulk user action is performed.
During login/logout the following query is executed:
SELECT name,value FROM mdl_cache_flags WHERE flagtype = 'accesslib/dirtycontexts' AND expiry >= '1461934824' AND timemodified > '1461934822'
there are three indexes in this table:
id,
mdl_cachflag_fla_ix,
mdl_cachflag_nam_ix
but mysql cannot use these in the above query so it takes signigicantly longer.
Creating additional indexes for columns expiry and timemodified solves this problem right away (in my testing environment with ~1000000 rows in this table, login time was reduced from minutes to almost instant).
This seems to be the same issue:
https://moodle.org/mod/forum/discuss.php?d=313049#p1253421
To reproduce this issue, you can insert a large ammount of any data into mdl_cache_flags or create a large number of users and do a bulk operation for all users.
Attachments
Issue Links
- has a non-specific relationship to
-
MDL-11555 index too long in cache_flags
-
- Closed
-
-
MDL-63771 Make more use of caches in accesslib
-
- Closed
-
- is duplicated by
-
MDL-63361 Accesslib: Roledefs cache is constantly purged
-
- Closed
-
- Testing discovered
-
MDL-61584 auth_ldap should use get_cache_flag() instead of get_cache_flags()
-
- Closed
-
- will help resolve
-
MDL-63361 Accesslib: Roledefs cache is constantly purged
-
- Closed
-