Under the hood of Moodle’s cron system

8 September 2017 by Brendan Heywood

At Catalyst IT we work with a lot of clients who have pretty big Moodle instances. This post looks at Moodle’s cron system.

One of the critical parts of Moodle LMS is the Task API, also known as the Cron System, that ticks along in the background 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 ramp 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 (CQUniversity) 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 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. You can explore it further at Github and Moodle.