On 4/16/07, Kelvin Wu <[EMAIL PROTECTED]> wrote:
but noticed sometimes cpu usage goes up to 30, and there are 80 httpd...
can't even log into mysql because 'too many connections', have to restart
apache and mysql.

Have you set MaxClients on your mod_perl server to something that
won't cause your machine to go into swap?  You can read about it here:
http://modperlbook.org/

While you're there, read about setting up a reverse proxy server too.

You should set max_connections on MySQL high enough that the number of
clients in MaxClients will be able to connect.

You should also check to make sure you are only using one connection
per httpd process.  You can just count the number of processes and
check the number of connections in MySQL.

i guess some 'bad' queries caused table locked? how to capture 'bad'
queries?

You can use the tool innotop to help see what's locked:
http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/

If you are using MyISAM tables, you should consider switching to
InnoDB to avoid locking problems.  You should also consider using the
"READ COMMITTED" isolation level with InnoDB instead of the default
"REPEATABLE READ".

- Perrin

Reply via email to