I have a WordPress 3.5.1 site that's getting a little bit of traffic (80 concurrent visitors, ~5 clicks/pageviews per second). The site runs fine until it spikes to ~85 visitors. There are usually 4 admins logged in at the same time. The site has 8 custom post types--Posts has 3500 posts, and Press Releases (a custom post type) has 13000 posts. All of this is paginated on the site, so there are never more than 20 posts showing on any one page.

The only plugins I'm using are wp-pagenavi and w3totalcache.

I set WP_DEBUG_LOG to true and logged the errors. The main error I'm getting (besides various notices and warnings unrelated to this issue) is mysql has reached the max_user_connections limit.

My current max_user_connections is set to 75. I tried to set it higher, but the cpu can't handle the load (4 Quad Core CPUs at 2.17GHz each and 4GB of RAM).

What could be causing so many connections?

I've viewed the mysql processes running when the errors happened and there are many connections that say "SLEEPING" or "SLEEP" (probably 15-20). I also noticed via the process logs that httpd is restarting quite often during the peak traffic times.

Any ideas on how to resolve the issue?

NOTE: Please do not respond if your answer is to check my wp-config.php file and make sure my username, password, and host are correct. This is NOT the issue. The site works fine under normal traffic.

  • I don't think this is a WordPress question.
    – vancoder
    Apr 25, 2013 at 17:20
  • Core is built on WordPress 3.5.1 Apr 25, 2013 at 17:22
  • Nevertheless, this looks like a MySQL / server issue, not specific to WP, and is therefore off-topic.
    – vancoder
    Apr 25, 2013 at 17:23
  • Well...that's what I'm trying to figure out. :) I've tried it on several different servers, and have seen the same error. Apr 25, 2013 at 17:31
  • I had found the solutions on the web...this can be happen because of so many reasons..you can check out the solutions below... webburr.com/wordpress/… wpbeginner.com/wp-tutorials/…
    – Webburr
    Apr 27, 2013 at 6:11

2 Answers 2


I have encountered the same kind of issue before, as you have already noted down the problem boiled down to mysql not accepting too many connections, The solution we implemented was to apply proper caching (check how often the cache is invalidated and other caching settings) and upgrade the mysql server.

As a quick fix, you could flush the connections on mysql using flush hosts;


If you have already installed w3tc I would strongly suggest that you try to optimize the settings.

Use page caching via memcache and a static asset CDN. This gives a performance boost of about ~95% for not logged in users for me on every page i used it.

Page caching, database caching and object caching are particularly usefull in taking load of the database server.

If you are not yet using a remote proxy in front of your webserver I would also strongly suggest you have a look at varnish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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