Apache can't create more than 400 workers - apache

I have a webserver that should handle about 800 simultaneous connections.
For this I have configured Apache 2.4 in worker mode (on Centos 6) with this values:
ServerLimit 40
StartServers 25
MaxClients 1000
MinSpareThreads 25
MaxSpareThreads 75
MaxRequestWorkers 1000
ThreadsPerChild 25
MaxConnectionsPerChild 0
However, when I check the server-status I can not see more than 400 workers simultaneously.
In error_log file I can see this: "[mpm_worker:error] [pid 2559:tid 140190319810368] AH00286: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting", but increasing this value has no effect. (with stop/start apache after each change in configuration file).
I checked the ulimits and for apache user the value of nproc is 2048.
I mention that Apache was compiled by me and I didn't set explicitly any limit at compilation time.
What could be the cause of this limitation?

So I figured out what was causing the issue. In httpd.conf the settings for worker module were declared before loading the module, so they were ignored by apache. Moving them after "LoadModule" section fixed the problem.

Related

Apache Busy worker thread increased to MaxRequestWorkers setting and getting error AH00286: server reached MaxRequestWorkers setting

In our production Apache servers i am observing error AH00286: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
My Environment:
I am using Apache Server version: Apache/2.4.18 (Ubuntu).
MPM worker config as bellow.
<IfModule mpm_worker_module>
ServerLimit 25
StartServers 2
ThreadLimit 64
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
ListenBacklog 511
</IfModule>
During this time there are concurrent request observed to the server however the HTTP response code for all requests are 200 for almost all request excluding very few 302.
I am running Bitbucket server behind reverse proxy.
Question1) how to find my ListenBacklog that is 511 is getting filled OR how to identify its not enough?
Question2) How do i reproduce this error ( i have used AB tool in the past but seeking advice to on this)
Question3) When i get this error, will new user requests & existing user request which are in the queue will be rejected?
Question4) I have enabled monitoring of thread usage based on the scoreboard usage (/usr/sbin/apache2ctl fullstatus) numbers, it prints busy worker thread as 150 and get reset to 0 in next Min when error is observed. is Apache reset all the worker thread when it gets an error as mentioned above?
Thanks in advance for attention on this matter.

How to check final Apache HTTPD Server configuration values

I am trying to configure Apache to handle a larger number of requests on Ubuntu 14.04. I have done so by adding the following to /etc/apache2/httpd.conf
MaxKeepAliveRequests 500
ServerLimit 20
StartServers 2
MaxRequestWorkers 1000
ThreadsPerChild 50
This doesn't seem to be having the desired affect as I am still receiving the error message "server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers settings"
I would like to confirm that I have set the values correctly and that they are not being overridden anywhere else by checking what values Apache actually has for those settings. Is this possible with Apache?
As it turns out, I missed that httpd.conf is not included/sourced in apache2.conf by default :-/

Scoreboard is full,not at MaxRequestWorkers

I an using Apache and Tomcat with mod-jk in my project. My web application is in Tomcat instances. I am using Apache jmeter for testing http load on tomcat. But I'm getting the error Scoreboard is full,not at MaxRequestWorkers even with 1000 threads.
[mpm_event:error] [pid 24313:tid 3075319488] AH00485: scoreboard is full, not at MaxRequestWorkers
[mpm_event:error] [pid 24313:tid 3075319488] AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
I've configured http-mpm for approximately 5000 threads.
httd-mpm.conf file is:
<IfModule mpm_event_module>
ServerLimit 200
StartServers 3
MinSpareThreads 75
MaxSpareThreads 250
MaxClients 5000
ThreadsPerChild 25
MaxRequestWorkers 5000
MaxConnectionsPerChild 5000
</IfModule>
Can anybody please guide me what can be the problem in this configuration?
It seems that Apache tries to gracefully finish some of the processes and hangs while doing so. It might be a problem of Apache (https://bz.apache.org/bugzilla/show_bug.cgi?id=53555) or a problem of the application itself.
You can easily check it by looking at the server-status page of apache. In order to do that you need to enable the status.conf apache module. Then go to your-server.org/server-status. You will see all the processes and threads currently being used or gracefully finishing ("G"-state). If you have to many G's that don't go away, you found your problem. It would look sth like this:
Too many threads gracefully finishing...
The solution is pretty simple. Just set MaxConnectionsPerChild to 0 or comment it out (mpm_event.conf). What this does is just let the process continue it's work without restarting it. That's a good thing in our case, since restarting the process let to the problem of having to many G's filling up the scoreboard and eventually crashing Apache.
Hope that helped.
I had this same problem. I tried different Apache versions and MPMs.
I seem to get this alot with MPM Worker. Also error does not reoccur using Apache 2.2.2
Are you using cPanel? IF so try /upcp --force and increase StartServers to a higher amount like 50 as that's all I did to get this error away.
This serverfault Q&A suggests that the event mpm may have a bug. The recommended settings for at least partial workaround:
StartServers 3
MinSpareServers 5
MaxSpareServers 10
ServerLimit 250
MaxRequestWorkers 250
MaxConnectionsPerChild 1000
KeepAlive Off
Try EnableMMAP Off
in 00_default_settings.conf

Configure Apache MPM worker module for 1000+ users at an instant

I have youtube proxy site http://playit.pk, the issue is that whenever users increase over 500 at an instant the server gets really slow. I am using MPM Worker module and have tried several configs..
Current one is:
<IfModule mpm_worker_module>
ServerLimit 40
StartServers 10
MaxClients 2000
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 50
MaxRequestsPerChild 0
</IfModule>
other configurations are:
Timeout 20
KeepAlive On
MaxKeepAliveRequests 100
Main server is only responsible for request handling, no streaming takes place here.
With the above configuration, still there is delay and apache shows around 1000 requests currently being processed.
Use fastCGI
FcgidMinProcessesPerClass 0
FcgidMaxProcessesPerClass 700

Limit of 1010 reached when loadtesting Apache/PHP with Tsung

I've been testing an Ubuntu server A running Apache/PHP using Tsung from a server B and I reached something that looks like a limit, but I can't find any idea on what it might be : here is a graph showing the behavior => http://i.stack.imgur.com/Mspqp.png The value given as max by Tsung is 1010 which doesn't look like anything I know from Apache/PHP/MySQL/Ubuntu configuration.
Server A was a virtual machine at DigitalOcean, running a simple installation of Ubuntu 12.04 and Apache2/PHP5/APC (Perfork MaxClients 384, ServerLimit 500) : usage of CPU or RAM was OK, not full. Apache's server-status page also showed open slots so the limit doesn't seem to come from there.
Server B was another virtual machine at DigitalOcean running a simple installationg of Ubuntu 12.04 and Tsung.
Webapp code included some PHP and some MySQL requests (500 max connections).
I can't find any configuration value in Apache/PHP/Ubuntu that would explain a 1000 or 1010 limit, any ideas on where to look ?
Please update below parameters which would support up to 8000 simultaneous connections.
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxClients 8000
MaxRequestsPerChild 10000
</IfModule>