Max connections limit configuration on Apache server - CentOS 6.4

24,442

You should check values in the /etc/httpd/conf/httpd.conf

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>

You should change processing model that you are using (may be it is worker)

You could try to determine how many clients could serve you server from output of the top/atop/htop

# top
top - 15:06:24 up 41 days, 16:18,  2 users,  load average: 3.58, 2.59, 2.34
Tasks: 204 total,   1 running, 203 sleeping,   0 stopped,   0 zombie
Cpu(s): 14.6%us,  0.5%sy,  0.0%ni, 84.3%id,  0.3%wa,  0.0%hi,  0.3%si,  0.0%st
Mem:  24676512k total, 14828220k used,  9848292k free,   343688k buffers
Swap:  2102456k total,      188k used,  2102268k free, 10690524k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
19965 apache    16   0  413m 113m 3980 S  5.7  0.5   3:11.01 httpd
20954 apache    16   0  383m  83m 3952 S  5.7  0.3   1:16.31 httpd
21274 apache    16   0  382m  81m 3988 S  5.7  0.3   0:29.20 httpd
21376 apache    16   0  371m  67m 3728 S  5.7  0.3   0:03.58 httpd
20943 apache    16   0  384m  83m 3948 S  5.3  0.3   1:18.98 httpd
20969 apache    16   0  384m  83m 3928 S  5.3  0.3   1:18.67 httpd
21264 apache    16   0  382m  80m 3796 S  5.3  0.3   0:27.93 httpd
21364 apache    16   0  379m  75m 3848 S  5.3  0.3   0:04.28 httpd
21370 apache    16   0  378m  75m 3712 S  5.3  0.3   0:04.31 httpd
21371 apache    16   0  378m  74m 3772 S  5.3  0.3   0:04.51 httpd
21374 apache    16   0  379m  74m 3804 S  5.3  0.3   0:03.50 httpd
21377 apache    16   0  379m  76m 3896 S  5.3  0.3   0:04.54 httpd
21043 apache    16   0  383m  82m 3976 S  5.0  0.3   1:17.40 httpd
21262 apache    16   0  382m  81m 3900 S  5.0  0.3   0:28.30 httpd

As you can see from the output - average amount of RAM required by one apache process (column RES) is ~80 mb

Share:
24,442

Related videos on Youtube

Sayed Jalil Hassan
Author by

Sayed Jalil Hassan

SOreadytohelp

Updated on September 18, 2022

Comments

  • Sayed Jalil Hassan
    Sayed Jalil Hassan over 1 year

    We have an Apache's and a CherryPy (Python) server running on on CentOs 6.4. Yesterday the Apache server suddenly went down while the CherryPy which uses the port 8080 works fine. We are trying to sort out the problem but no luck. It seems like there was something wrong with max simultaneous connections but we don't know how to fix that or even figure the real issue out. The errors log files has something like this :

        [Sun Aug 04 04:47:16 2013] [notice] mod_python: Creating 4 session mutexes based on 10       max processes and 0 max threads.
        [Mon Aug 05 21:57:31 2013] [notice] mod_python: Creating 4 session mutexes based on 10   max processes and 0 max threads.
        [Mon Aug 05 21:58:46 2013] [error] server reached MaxClients setting, consider raising the MaxClients setting  
    

    Does any one know how to fix this issue ?
    P.S. we are completely newbies to the server stuff.

  • Sayed Jalil Hassan
    Sayed Jalil Hassan over 10 years
    Thanks for the response. our default configuration had both max clients and serverlimit set to 10. is there a standard way to determine this based on the server specs like RAM etc ?
  • voretaq7
    voretaq7 over 10 years
    @user184553 You really need to do load testing to determine what your server can handle. See serverfault.com/questions/350454/… and stackoverflow.com/questions/4745833/… for some tips (or just increase the limit by 100 and you'll probably be fine on reasonably modern hardware as long as (ServerLimit * Resident RAM per server) is less than your system's RAM & you're not CPU or I/O bound)