Moodle server overloaded

Moodle server overloaded

by Miguel Angel Velasquez Teran -
Number of replies: 1
Picture of Particularly helpful Moodlers

We have a moodle 3.7.6 working in a dedicated server with CPanel:

CPU 8C/16T

64 GB RAM

960 GB SSD

Apache 2.4

PHP 7.2

MariaDB 10.3

Our Moodle is working since one month ago with total 1600 users and 500 - 700 concurrent users. During the last week, we got a DB and CPU overload making the site even inaccessible. Also we usually got Error: Database connection failed.

I will appreciate your help,

Average of ratings: -
In reply to Miguel Angel Velasquez Teran

Re: Moodle server overloaded

by Ken Task -
Picture of Particularly helpful Moodlers

Thanks for description ... helps ... cPanel is just an interface into server for config.  It probably doesn't have tools/icons to check things in a fashion where one could find the 'bottlenecks' ... nor do those tools actually have any recommendations as to what one might tweak for errors such as you have mentioned.

Check your web servers error log.   Do you see any 'Server has gone way' errors?

Thus ... ssh into server and install via package manager a thing called 'MySQLTuner'.   It is a perl script ... and your system (since it runs cPanel) should already have perl.  Dynamic apps like Moodle work best when DB server is optimal ... DB servers are optimal when most of the DB's are in memory of the server.  But it's a balancing act ... web service + whatever else server needs to do vs DB server.

Catch 22 though .. need to run the MySQLTuner.pl script as the superuser for your DB server to see full report of what tuner finds about your MariaDB server.

Tuner will have sections in it's report and at the tail end recommendations for tweaks.   Research the tweaks, however, cause setting something too high gets deminishing returns.

tuner sections to pay attention to:

Performance Metrics

[--] Physical Memory
[--] Max MySQL memory
[--] Other process memory:

[OK] Maximum reached memory usage: xG (x% of installed RAM)
[OK] Maximum possible memory usage: xG (x% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/##M) - is good
[OK] Highest usage of available connections: x% (n/nnn) * yours probably has problems here.
[OK] Aborted connections: 0.00%  (0/nnnnnnn) * yours probably has problems here

Important in InnoDB Metrics

[OK] InnoDB buffer pool / data size: xG/xMorG

[OK] InnoDB buffer pool instances: 2

IF data size larger than buffer pool ... not good - poor performance, etc.

Variables to adjust: at bottom of report ....  **research** the recommendations and apply or not.

Must restart mariaDB server after making tweaks.

Results may not be seen first hour/day ... have to let DB server run and monitor - run tuner again! smile

'SoS', Ken

Average of ratings: Useful (1)