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.

I am working right now with PHP website on my client's dedicated server and I get periodically an error too many connections but ~5 users are browsing this page.

In phpMyAdmin I can see that max connections variable is set to 400.

On our local MySQL server in my corporation we have max connections set to 200 and other mates uses in the same time this server.

I heard that on their server some other web is using the same MySQL with big trafiic.

Here are my questions:

  • How to debug this problem?
  • Can I look into some list of SQL queries that was executed in last 10 minutes to check if it is our problem or their?
share|improve this question

1 Answer 1

up vote 2 down vote accepted

The symptoms you describe point to persistent connections. In some setups PHP does not handle persistent connections very well: it tends to open new connections rather than reuse the existing ones. I suggest you disable this feature and see if the issue persists:

If you notice an improvement, you can try to fine tune persistent calls or get rid of them permanently.

share|improve this answer
    
I also shoot that case. At all I can not modify their web/server configuration to make that changes (my web does not uses persistent connections anywhere). Tomorrow I am going to meet their man and I will ask them to do that. –  hsz Jan 18 '10 at 15:26
    
This doesn't require modifying any server configuration. You would just need to update the PHP scripts for the application. –  Michael Mior Jan 18 '10 at 15:37
    
Sure, but I have no access to the second webpage which is also using the same MySql server - so I can not update their PHP script that may uses mysql_pconnect. phpinfo() shows me that ` mysql.allow_persistent` is On. Changing that flag to Off will not give any results at all - it should be changet on their machine. –  hsz Jan 18 '10 at 15:46
    
They changed mysql.allow_persistent to Off and our CMS accelerated and now there are no problems with connections. Thanks! But I am still wondering how to check what scripts was connecting with MySql server? –  hsz Jan 20 '10 at 12:20
    
SHOW PROCESSLIST tells you the user, host, DB and (if you're lucky) query. –  Álvaro G. Vicario Jan 20 '10 at 16:30

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.