Hi,
My moodle platform contains very large courses (900 sections and 5000 modules on average). Course caching takes a while (several minutes and several thousand of database queries). On any course modification, the cache is rebuild.
I increase the values of MAX_MODINFO_CACHE_SIZE and CONTEXT_CACHE_MAX_SIZE to limit the amount of database queries:
// config.php
define('MAX_MODINFO_CACHE_SIZE', INF);
define('CONTEXT_CACHE_MAX_SIZE', INF);
But there is still costly repeated database queries on all pages, when I used section options :
$section_info->{option_name};
# ...
SELECT id,name,value FROM mdl_course_format_options WHERE courseid = '206' AND format = '...' AND sectionid = '2202'
SELECT id,name,value FROM mdl_course_format_options WHERE courseid = '206' AND format = '...' AND sectionid = '2207'
SELECT id,name,value FROM mdl_course_format_options WHERE courseid = '206' AND format = '...' AND sectionid = '2212'
SELECT id,name,value FROM mdl_course_format_options WHERE courseid = '206' AND format = '...' AND sectionid = '2216'
# ...
or when I want to get user-depended data :
get_fast_modinfo($course, $user);
How to improve the cache performance and how to limit the amount of repeated database queries?
My configuration :
- Moodle: 2.9 (Build: 20150511)
- Database: MariaDB Galera Cluster
- Cache stores: Memcached server for application and session caches