I host four wordpress sites on a dedicated server from OVH. I found that my wordpress sites were taking a long time to load up. Sometimes, when I tried saving posts, they were erroring out. This sounded highly suspicious of memory issues on the server, so I decided to check.
I ran a free -m htop on the server, and found that most of the 4GB of RAM the server had had been used up by various processes, mainly spawns of mysqld (mysql daemon) which used around 1.6GB. The rest were used by clamav, bind service and others.
Turning off performance schema.
Add under [mysqld]:
performance_schema = off
I didnt tamper with the rest of the settings. But on a restart of the mysql daemon, the memory usage went down to 580-760MB, something the server can live with.
Next I uninstalled the clamav package:
apt remove clamav
Next I stopped and disabled loading of bind, since its named process was taking another big chunk of memory. I did this by lazily using the virtualmin settings (Webmin>System>Bootup and Shutdown>bind9>Disable now and on boot)
After this, almost 800MB of memory became free, and system load came down to 0.16. Now, the main memory hoggers are mysqld (760MB), apache2 (400MB), php5(350MB), and rsyslogd(250MB). I could probably tune them if I read up on their finer settings. But for now, my server has started performing smoothly.