Apache - max clients reached issue

Hi,
I have a web application (using apache) and for the past 2 months I am getting the below error in my production environment. I want to re-produce the same issue in my non-production environment, could you please let me what all are the parameters I have to modify in order to do that. Also I don't want to open too many sessions for this, please help me in re-producing this issue by opening minimal sessions.

Error :- [error] server reached MaxClients setting, consider raising the MaxClients setting

Below are my apache settings:

I have read multiple blogs to understand this, but could not able to understand the settings,so please help me on this. Thanks.

32 MaxClients can be relatively low, but before raising it you need to look at what your current MaxServers setting is. MaxClients cannot exceed MaxServers (MaxServers sets the hard limit).

Please post your MaxServers parameter from your apache2.conf file.

Edit: Corrected mistakes in this post below ... Neo

How is MaxServers different from MaxSpareServers?

I'm not trying o hijack the thread, I'm just being curious as I don't see any "MaxServers" option in one of my httpd.conf files.

1 Like

Hey, you are right for correcting me, thanks. :o

MaxServers was depreciated a number of years ago and replaced with MaxSpareServers, as I recall.

MaxClient is the overall process (hard) limit, not the other way around as I mistakenly posted above.

Sorry about that.... :o

---------- Post updated at 16:33 ---------- Previous update was at 16:31 ----------

FWIW, here is an example from one of our Apache servers:

<IfModule mpm_prefork_module>
    StartServers         64
    MinSpareServers      64
    MaxSpareServers      128
    #MaxClients           256
    MaxClients           272
    MaxRequestsPerChild  0
</IfModule>

Hi,
Could you please tell me how I have to test my scenario.

Thanks.

You can simulate the error message in your lab by reducing the MaxClients from 32 to 2 as an example and restart the webserver. From their, open 3 browser connections to the webserver. The first 2 will success and the 3 will timeout. Take a look at the error log and you should see the corresponding message.

Mike

I have changed the setting in conf and tried to simulate the issue. But its not working.

Here are the steps I did:

  1. modified the conf
    KeepAlive Off
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    MinSpareServers 3
    MaxSpareServers 6
    StartServers 4
    MaxClients 2
    MaxRequestsPerChild 200

  2. restarted the webservices

  3. Opened the application more than 4 sessions in different browsers from my system.

  4. But issue didn't occur:mad:

Please check this and let me know if I did any mistake here.

Thanks.

You can't have....

when

MaxClients is the maximum..... in your case, now 2.

So I need to remove the below entries from my conf..?

MinSpareServers 3
MaxSpareServers 6
StartServers 4

Thanks.

What kind of page were you accessing for your test? If the pages being tested are small you may not see a timeout however you may see a delay before the page is served on attempt #3 and #4. These tests do have to be simultaneous in order to get the desired effect. Have you taken a look at the errors log to see if the message is being produced?

Mike

Instead of testing it manually you can use Apache ab.