Under the hood of Moodle’s cron system

by Brendan Heywood

At Catalyst we work with a lot of clients who have pretty big Moodle instances.

One of the critical parts of Moodle is the Task API aka cron system which ticks along in the background behind the scenes doing important things like sending out forum emails, and processing things at set points in time without any interaction in the user interface. As with any software as you scale up, you can run into issues with performance and scaling, and Moodle doesn’t provide any tools out of the box to help you see what’s really going on under the hood.

Working with Central Queensland University (CQU) and their Moodle, we have created a new Moodle administration tool plugin which adds instrumentation to the Moodle Task API and records statistics on when cron tasks have run, how long they took, which underlying infrastructure they ran on, and even information on the tasks which are currently running right now.

All this information is available to Moodle administrators via Moodle’s User Interface. We’ve found it extremely helpful in diagnosing problem areas, and in helping validate changes to code and infrastructure to make things faster and scale better. We have open sourced this tool and it is available now in the Moodle plugins directory.

We are also pretty pleased that it also won the reviewers choice award. Well done to our Melbourne developer Nicholas Hoobin for a great job implementing this plugin.

https://github.com/catalyst/moodle-tool_lockstats

https://moodle.org/plugins/tool_lockstats

We will be presenting on this tool in more detail, along with other Cron performance and scaling tools and processes at the Moodle Moot 2017, we hope to see you there!