Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sometimes my website 'goes down' due to Mysql consuming all the resources, but I think it does not stop creating more httpd processes. Is that possible? If I restart apache, these processes disappear and I can see the CPU consumption by the mysql process go down slowly, and then the site is online again.

I'm having trouble finding the bottleneck anyway. The site has a lot of cronjobs (php scripts), and each one generates logs, which include the total execution time.

So my first thought was to try to find the script that took a lot of time, but that was not possible because it takes only one of them slowing the mysql server, to have all of them increasing their execution time.

Any advice?

Where can I learn how to find the bottlenecks?

Note: I'm on CentOS, apache 2, php 5.3, and mysql 5

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You should start with the slow query log: http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html

You may also want to check to see if max_used_connections is higher than max_connections:

SHOW VARIABLES LIKE 'max\_connections';
SHOW STATUS LIKE 'max\_used\_connections';
share|improve this answer
    
Should max_user_connections be higher or lower than max_connections? I have set both to 100000, because I was getting errors from scripts that were failing to connect to the DB. –  HappyDeveloper Sep 7 '11 at 1:44
    
I was suggesting that you examine the values to see if the server hit its limit (max_used_connections >= max_connections). For setting the max_connections, have a look at Calculating Maximum Connections for MySQL Server –  xofer Sep 7 '11 at 2:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.