Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: MaxClents/Server Limit |
|
Author |
|
Danll
Joined: 02 Aug 2013 Posts: 49 Location: USA, Houston
|
Posted: Sun 02 Mar '14 6:25 Post subject: MaxClents/Server Limit |
|
|
Just upgraded my MacMini to 10.8 from 10.6, and I have my Apache 2.2.24 running. Everything is working well *except* in my error_log, I get many errors there like this ...
Code: | Fri Feb 28 16:50:08 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
WARNING: MaxClients of 150 exceeds ServerLimit value of 133 servers,
lowering MaxClients to 133. To increase, please see the ServerLimit
directive.
|
So, um, what's going on? Never saw this before.
Now, I know that I can put ServerLimit and MaxClient settings in my httpd.conf file. My httpd.conf file currently has no such settings. I also know that such settings are present in my extra/httpd-mpm.conf file.
So, several questions. I need answers to all of them.
If I'm going to play with ServerLimit and MaxClient, where should that be done? In http.conf? Are "extra" files actually used, or are they just there for reference? (That is, if I set these in that extra/httpd-mpm.conf file, will those settings even be used?) Finally, what values should I specify? It is, by the way, not obvious where ServerLimit was set to 133 and MaxClients was set to 150. I didn't do that! Finally, what exactly is the "Session Cache" that is not configured?
I must say, doing web serving from 10.8 is a real PIA.
Thank you in advance for your insights. |
|
Back to top |
|
maba
Joined: 05 Feb 2012 Posts: 64 Location: Germany, Heilbronn
|
Posted: Sun 02 Mar '14 14:15 Post subject: |
|
|
Hi,
most of that is described in some detail in the Apache documentation. Running a server is always tough work and industry figures say that you can run about 15 - 20 individually configured servers (as opposed to clone and go) with one full time SysAdmin.
Now to your questions:
- Apache has multiple ways of handling concurrent requests. Multi-process or multi-threaded. So to be able to configure the level of concurrency you have some parameters: ServerLimit, MaxClients are two of them. ServerLimit is the maximum number of processes (in the multi-process scenario) that Apache is allowed to have. Similar for the threaded model. This is the absolute upper limit.
Now "MaxClients" is the number of different clients that may connect to the server at a time. As one client can potentially open more than one connection with the server, MaxClients must always be lower than ServerLimit, which is what the WARNING message is telling you.
The place where you configure those is up to you. This depends pretty much on SysAdmin preference. The most common out of the box location for both is .../conf/httpd.conf. Sometimes it is moved out to conf.d/extra/httpd-mpm.conf.
The SSLSessionCache warning is something which is completely unrelated. You have configured SSL. Establishing SSL connections from scratch is expensive (with regards to the time it takes for the SSL negotiation). So it is a good idea to provide what is called an SSLSessionCache. This is the name of a file or a place in shared memory, or ... whatever you choose. Typically this is configured in the ssl config file .../conf.d/extra/httpd-ssl.conf. But again, it is up to you in which file you configure it.
Maba |
|
Back to top |
|
Danll
Joined: 02 Aug 2013 Posts: 49 Location: USA, Houston
|
Posted: Sun 02 Mar '14 17:15 Post subject: |
|
|
Thank you. That's a BIG help. But what I'm still trying to understand is whether to make those specifications in httpd.conf or extra/httpd-mpm.conf. The latter file is just sitting there. But is Apache looking at it? That is, if I add lines to httpd.conf to do this specification, is the extra/httpd-mpm.conf file going to override that? Can I just trash the latter file?
I know what needs to be specified, but not where those specifications need to be made.
What, precisely, does "extra" mean? As in "extra stuff that Apache looks at", or "extra stuff that is not currently used but you might want to use"? |
|
Back to top |
|
maba
Joined: 05 Feb 2012 Posts: 64 Location: Germany, Heilbronn
|
Posted: Sun 02 Mar '14 19:09 Post subject: |
|
|
All "extra" configs are included from the main "httpd.conf" using include directives. The way, the default config is set up, is meant to make it more modular.
By default all includes are commented out (# at the beginning of the line). So any changes to extra/httpd-mpm.conf will go unnoticed. This is Ok for a Windows based setup as Windows uses the Multi-threaded worker.
So the config lines for MaxClients and ServerLimit should go into httpd.conf.
What is strange is the SSL warning. This would mean you did enable the SSL module but did not include the SSL config file (which is also in the "extra" folder). To include that, just uncomment the line
#Include conf/extra/httpd-ssl.conf
But then you will still have to adapt the content of the ssl config file.
Maba |
|
Back to top |
|
maba
Joined: 05 Feb 2012 Posts: 64 Location: Germany, Heilbronn
|
Posted: Sun 02 Mar '14 19:11 Post subject: |
|
|
Regarding overwrite:
if you have double config lines for things that may only specified once, Apache will issue a warning about that and will tell you which one takes precedence (which is the first one).
Maba |
|
Back to top |
|
Danll
Joined: 02 Aug 2013 Posts: 49 Location: USA, Houston
|
Posted: Sun 02 Mar '14 21:00 Post subject: |
|
|
I uncommented
Code: |
Include conf/extra/httpd-ssl.conf |
in my httpd.conf file. But that just hosed my server. Not sure how I have to adapt the content of that file it points to to make it work.
I did try to add
Code: | Timeout 150
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 5
<IfModule prefork.c>
StartServers 20
MinSpareServers 20
MaxSpareServers 30
ServerLimit 256
MaxClients 150
MaxRequestsPerChild 10000 |
to my httpd.conf file. That didn't hose my server, but it didn't get rid of the MaxClients error either. That error still tells me that ServerLimit is 133, so it evidently isn't paying any attention to these new directives I put in httpd.conf. |
|
Back to top |
|
Danll
Joined: 02 Aug 2013 Posts: 49 Location: USA, Houston
|
Posted: Mon 03 Mar '14 16:19 Post subject: it works! |
|
|
OK, a correction. After adding those lines to my http.conf file, *not* uncommenting the http-ssl.conf line there, and not doing anything with the files in the extras directory, it seems to work. Now, I got an error after making this change yesterday, but it was within a minute of when I made it. I have now gone 24 hours without an error of the kind I described. So evidently my Apache is now happy with MaxClients and ServerLimit.
I don't recall if after I made those changes I immediately restarted Apache. It may be that it took this subsequent error, and automatic recovery and restart to get Apache to read my newly revised httpd.conf file, whereupon everything is good.
So many thanks for your help and education. |
|
Back to top |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Wed 05 Mar '14 9:42 Post subject: |
|
|
Prefork is the MPM not supported on Windows OS. If you want to allow higher number of clients to your Apache on windows use this directives:
ThreadLimit 15000
ThreadsPerChild 5000
I will allow for 5000 connections simultaneously and allow you to increase it to 15000 if needed. One of my Apache instance works with 15000/12500 values very well.
EDIT
Oh, it's on Mac |
|
Back to top |
|
|
|
|
|
|