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!
'SoS', Ken