Re: How does Prefork work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CrystalCracker wrote:
Thanks a lot for the response.

I will do some ab and siege tests to verify it, but I am trying to
conceptually understand it first.
<IfModule prefork.c>
StartServers         5
MinSpareServers   5
MaxSpareServers 20 MaxClients 250
MaxRequestsPerChild  4000
</IfModule>

I have at least 20 active apache threads (ps -ef | grep httpd), average is
about 40 threads and goes upto 70 at the peak. Does the above setting sounds
resonable?
With Apache prefork, you do not have "threads".  You have independent
"children processes".  Since this is one of the main topics of this ..
thread, it probably helps to stick to the proper nomenclature.

(In addition, the Apache naming for the parameters really does not help
in this case, since above the children are called "Servers".. ;-) )

My own subjective comments to the parameters above :

Why set MaxRequestsPerChild to 4000 ?
It means that after a child process has served 4000 requests, Apache
will kill it and start another one.  Starting a new child is rather
heavy, and 4000 requests is not all that much, when you consider images,
 stylesheets, etc..  About the only good reason to put it that low (or
put it at all), is if you know that your request processing modules have
some kind of resource leak, and grow over time to unacceptable levels or
something. Is that the case ?

StartServers, MinSpareServers and MaxSpareServers play together, and the
on-line doc is quite clear about reasonable values.

MaxClients determine how many client requests can be in the process of
being handled at any one time.  That's probably the most important
parameter. In principle, you want this as high as possible.
But ...
1) each request being processed means one child process dedicated to it (aka active and running). And each one of those uses memory and other
resources.  And you don't want to use more memory than you have
physically on your system, or the system will start to swap and get
/much/ slower.
2) how many requests you /want/ to be handling simultaneously, and you /can/ handle simultaneously, and you really /will/ handle simultaneously, is very dependent on many things. The only way to find out the correct setting in your case, is to set a reasonable number first (50 ?), and then watch your server.

Also, watch the KeepAliveTimeout directive, and do not set it too high (max 5 seconds or so, probably 2 is better). Theoretically, the KeepAlive feature is meant to improve performance, by allowing a browser to issue several successive requests using the same TCP connection to the server (for example for in-line images in pages). It thus avoids the overhead of creating and closing TCP connections all the time (at the server as well as the client side). However, it also means that if a browser does /not/ send new requests on that connection, the Apache child that handles that client connection has to sit around doing nothing anyway (waiting for a new request on the connection, which will never come), and is using resources, but is not available for other requests. So if a new request comes in from another client, Apache will have to use (and maybe create) another child for it.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux