Posted October 7, 2009 by Spyros in DBMS / Databases

How to Save RAM Usage on mySQL


Running a server with Apache2, mySQL, cron and more can really be a RAM intensive procedure. If you are running multiple virtual websites, there could be a chance that your RAM is just not enough. Therefore, there is the need to decrease the RAM usage somehow.

One very good solution to do that is just install a less RAM needing webserver. Instead of using apache2, one could turn to lighttpd for instance. The latter is a very secure, robust and lightweight webserver. The only real problem that i’ve encountered with this one is the fact that the rewrites engine needs different configuration when compared to the standard one used in apache.

Therefore, if you decide to stick to apache, you should find a way to make it need less resource hungry. Luckily, there is a very nice thing that you can do that will save you about 100MB of RAM ! This is about disabling the InnoDB support for mySQL. While InnoDB is faster at some occasions, it is really not worth using it for your websites unless you receive really lots of visitors (which is a sign that you need more RAM whatsoever).

MyISAM is just great for your casual needs. If you disable InnoDB you will not notice any difference in your website’s performance really, but you will notice a whole bunch of difference to your memory usage.

How to Disable InnoDB support ?

Disabling InnoDB support is very easy. Just locate the mySQL configuration file (usually located at /etc/mysql/my.cnf) and add the line :


That is all you need to do ! Now just run a command like :

free -m

to check on your actual memory usage and you will notice some real difference.