To optimize MariaDB you will need to located the 50-server.cnf file and edit it. This example assumes a moodle server with about 90GB of RAM and an estimated student population of about 6000 students and expecting a traffic load of 300 concurrent students taking an online quiz.
On Ubuntu locate and edit the the 50-server.cnf files
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
On CentOS/RHEL:
sudo nano /etc/my.cnf.d/50-server.cnf
Add the [mysqld]
section with the configuration settings:
[mysqld]
innodb_buffer_pool_size=64G
innodb_log_file_size=2G
innodb_log_buffer_size=256M
max_connections=1000
query_cache_size=0
query_cache_type=0
table_open_cache=4000
thread_cache_size=256
Save the changes and exit the text editor. In nano
, you can do this by pressing Ctrl+X
, then Y
to confirm, and then Enter
to save
Use the command below to restart MariaDB
sudo systemctl restart mariadb