Moodle performance analysis revisted (now with MariaDB)

Justin -- 24 September 2013

This is a follow-up to my previous post on this subject. Pleases refer to that post for the testing environment setup and also the scenarios that were tested. Below I will outline what has changed since those results were gathered and the problems I was addressing with these changes.

I also ran the original tests with MariaDB 5.5.31 and the graphs on this post are comparing 2.4.5 and 2.5.1 with Percona MySQL and MariaDB on each version of Moodle using only the default filesystem MUC caching implementation.

Reducing manual work

Previously I was running each test manually in my browser and then copying the web server error log file into a named file (for later running an analysis script against). This had two problems:

  1. The time between each request in my web browser was not consistent. Sometimes I was refreshing pages immediately after the previous page had loaded and sometimes I was waiting up to over five minutes between each subsequent page request.
  2. I had to manage a lot of separate log files which meant a lot of possibilities for mistakes and also running the same script over and over again on each file.

I solved these problems by creating some automated Selenium test scripts (using the Firefox IDE extension) and adding a URL parameter to each individual page request so that I could gather the statistics for the requests generated for each page within an error log file that contains the requests for all of the page requests.

This gave me the following improvements:

You can use the code I created for these tests as it’s publicly available on my Github account – moodle_perf_scripts.

Testing results

1. Unauthenticated user site index page

2. Login process for a site administrator

3. Authenticated site administrator site index page

NOTE: the numbers for this test might be slightly deceiving. The settings used for the display on the site index page when logged in produce different results in 2.4.5 and 2.5.1. In Moodle 2.4, a count of the number of courses was displayed along with a search box. In 2.5.1 a large number of the courses are listed on that page which produces much more database access. This is why the numbers for 2.5.1 are much worse than 2.4.

4. Authenticated student site index page

5. Authenticated site administrator course view

6. Authenticated site administrator gradebook view

Analysis

MariaDB is based off the MySQL codebase but the team there has included a number of optmisations on that codebase, some of which greatly impact Moodle performance. The one page which greatly shows this is the gradebook. With Percona MySQL the average load time for a single page in the gradebook was greater than 90 seconds. But the average page load time for MariaDB was less than 4 seconds!

With the MariaDB binary compatability with MySQL files (i.e. you can switch between which server you are running with the same database files without any issue) it makes sense that anyone hosting a large Moodle site using MySQL should be looking at switching to MariaDB.