Reducing MySQL memory usage
My other site, http://www.aqua-mail.com is hosted in Xen virtual machine with 512 MB of RAM.
Of those 512, about 300 were taken by MySQL daemon, causing some swap use.
I was able to get MySQL down from 300 to about 60 megabytes of RAM by doing the following.
Most of my tables were already using MyISAM engine, but there was a couple using InnoDB.
1) Converted the remaining tables from InnoDB to MyISAM, by running this in the PhpMyAdmin SQL window:
ALTER TABLE table_name_here ENGINE=MyISAM;
2) Disabled InnoDB support by creating a new config file in /etc/mysql/conf.d, with this content:
[mysqld]
default-storage-engine = myisam
skip-innodb
The file can have any name you want, as long as it ends with “.cnf“.
3) Restarted MySQL:
service mysql restart
I’m sure InnoDB is a terrific engine, and Oracle had a very good reason for making it the default starting with MySQL 5.5.
However, for a low-memory VPS system, low-traffic web site, avoid swap should probably be a priority.
-
January 26, 2013 at 6:48 am | #1Nagios tablet: part II – LAMP setup « Anonymous Geek