High Memory Usage? Look into mysqld!
So, it appears that everyone's favorite control panel cPanel, has blessed us with broader support for database tables. Like most things in a finite environment like a computer system, each blessing has a curse.
Soooo, what's the curse?
Memory.
Check out your usage for mysqld. This should normally be quite low (20-30MB if you are good at tuning). Currently, I am consistently seeing examples of over 120MB (using 'ps faux'). Quite the change.
So how can we "fix" that?
Depends... Do you need anything other than MyISAM tables? If the answer is "what are MyISAM tables?", you probably don't. The answer to "what are MyISAM tables" is "the default table used by mysql".
So, under the heading of "An ounce of prevention is worth a pound of cure", let's make SURE that only MyISAM is being used.
First, log into WHM.
Then select "phpMyAdmin" under "SQL Services"
This will being up a new window for phpMyAdmin
On the left side of the window, there will be a drop down with all of your databases in it, select the first database.
Check the 4th table "Type". Note which type of table is used. Note anything other than MyISAM
Continue through all of your databases, looking for anything other than the default MyISAM.
Once you have confirmed ALL of the tables that your databases use, it's time to get dirty.
SSH into the system with putty or some other ssh utility
vi /etc/my.cnf
at the end of the section that starts with [mysqld] you want to add the following lines to turn off support for innodb and bdb.
skip-innodb
skip-bdb
restart mysql with '/etc/init.d/mysql restart'
Here are my before and after results
mysql 20092 0.0 0.1 112692 15956 ? Sl Sep09 0:51 \_ /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysq
Notice the "112692"? That's 112MB of usage for mysql! I have NO websites setup on my server, it's just my sandbox that I break!!!
After I added the 2 skip- lines
mysql 30632 0.0 0.0 22024 3620 ttyp0 Sl 10:42 0:00 \_ /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysq
22MB of usage. That's a 90MB drop on my system.
If you have any questions about these steps, feel free to ask, I can make up an answer as I go along :-)
Last edited by Ted@spry; 09-20-2007 at 10:52 AM.
|