Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Server details:

HDD: 1000GB
OS: Linux 2.6.32-220.7.1.el6.x86_64
Processor: 6 Core

Please see the link below for my # top preview:

I can often see the error mentioned in title in my plesk panel and my /etc/my.cnf configuration are as below:







As my server httpd conf is set to /etc/httpd/conf.d/swtune.conf and the configuration is as below: at prefork.c:

<IfModule prefork.c>
StartServers       8
MinSpareServers   10
MaxSpareServers   20
ServerLimit     1536
MaxClients      1536
MaxRequestsPerChild  4000

If I run grep -i maxclient /var/log/httpd/error_log then I can see everyday this error:

[root@u16170254 ~]# grep -i maxclient /var/log/httpd/error_log
[Sun Apr 15 07:26:03 2012] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Mon Apr 16 06:09:22 2012] [error] server reached MaxClients setting, consider raising the MaxClients setting

I tried to explain everything that I changed to keep my server okay, but maximum time my server is down. Please help me which parameter can I change to keep my server okay and my sites can load fast. It is taking too much time to load my sites.

share|improve this question
Looking at the history of your questions, I think it might be about time to hire an experienced sysadmin who already knows all this stuff. You will learn much faster and your site will be stable and will perform better much sooner. – Ladadadada Apr 16 '12 at 13:06
up vote 1 down vote accepted


With a MaxClients setting of 1536 and each Apache child using around 69MB of RAM, you need just over 100GB of RAM to avoid swapping out "hot" parts of Apache's memory. May I suggest you lower that value until it fits inside your available RAM? Swapping like that will make your server horrendously slow.

Since you are running MySQL on the same server, I would go for about half of your available RAM for each service, so MaxClients 115 would be appropriate for you. Maybe a little lower if you want to leave a little breathing room around MySQL.

Now, on to MySQL, which is likely the actual cause of your server going slow. MySQL is using a lot of CPU and very little RAM. Three things to do:

  1. Turn on the mysql slow query log and set the long_query_time to something high like 10 or 20 seconds. Slowly lower that setting until you start catching slow queries. Once you know which queries are causing the problem, tune them by adding appropriate indexes or modifying the query. Tuning queries is a major topic and there are several good books on it.
  2. Run and follow its recommendations. ( wget )
  3. Install a server performance monitoring tool such as Cacti, Munin or Zabbix (there are other options) and add the "Better Cacti Templates" or "Appaloosa Templates".

Going with the "half for each service" idea above, will tell you the maximum amount of RAM that MySQL can use but you are unlikely to ever see this as it relies on per-connection RAM allocation and you will never see all 20,000 connections you allow. Instead, watching what MySQL actually uses and making it use about 2/3rds - 3/4ths of the remaining RAM is a sensible value.

You should probably lower your query_cache and query_cache_limit and raise either key_buffer_size or innodb_buffer_pool depending on which engine you use. will have better recommendations than I do.

The error message you used as the title for this question is related to the wait_timeout setting of MySQL. Some process has opened a connection to MySQL and then waited at least 300 seconds between commands. If this was a web request, raising this value is not the right solution. 300 seconds is far longer than people will wait around for a web request to complete. Fix whatever is causing the load average to be so high (probably the other slow queries and the swapping) and the requests will be faster.

share|improve this answer
Thanks for your great information, what about these 2 parameters. max_connections=20000 max_user_connections=20000 – Barkat Ullah Apr 16 '12 at 11:43
Those are probably higher than your server can handle too, but you won't ever hit them unless each Apache child is opening 200 connections to the same database simultaneously. I prefer to leave those high and hit your limits at the Apache level rather than the MySQL level. – Ladadadada Apr 16 '12 at 11:48
Thanks a lot, i am changing the tags accordingly and then monitor my server and come back to you soon. – Barkat Ullah Apr 16 '12 at 11:55

Your Answer


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.