"What do you mean by all in one server ?"
Apache + code + DB server (thus DB for moodle) + moodledata on *same* machine. Uhhhh ... you didn't share setup info so how was anyone able to guess your setup.
Since the code is on a Linux flavored box, config to other flavored servers for moodledata is (as you have discovered) a factor. DB should also be considered in that light.
Since DB is also hosted on another OS/platform, dunno that following would work as well, but another 'tool' is MySQLTuner. A perl script for checking out MySQL/MariaDB.
https://github.com/major/MySQLTuner-perl
Run from web server to DB server is very true to how your site is to function and involves networking ... the layer below but comes before application (ie, the moodle).
'SoS', Ken