httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Bell <d...@plainblack.com>
Subject Re: [users@httpd] How does Prefork work?
Date Thu, 28 May 2009 20:33:06 GMT
On May 28, 2009, at 2:55 PM, 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?
>
>

Firstly, please don't top-post. It is difficult to maintain the thread  
of conversation when you top-post.

Next:

MaxClients at 250 means that potentially 250 httpd processes can be  
running at once. Do you have the memory to support that many without  
swapping? Swapping usually ends up killing a system, especially if  
it's already handling a lot of disk i/o.

MaxSpareServers at 20 means that at most 20 servers will sit there  
idle. MinSpareServers means at least 5 will sit idle. These are best  
tweaked for how you want the server to respond to a mass influx of  
traffic. Does your traffic tend to be steady throughout the day or  
does it spike sharply once or more? If you have spikes, then your Min/ 
MaxSpareServers are fine as they are. If not, you might want to reduce  
the MaxSpareServers to 10 so that the memory can be reclaimed and used  
for better things.


>
>
> Doug Bell-4 wrote:
>>
>> On May 27, 2009, at 11:14 PM, CrystalCracker wrote:
>>
>>>
>>> Can anyone explain me how exactly prefork works?
>>>
>>> StartServers 2
>>> MaxClients 150
>>> MinSpareThreads 25
>>> MaxSpareThreads 75
>>> ThreadsPerChild 25
>>> ServerLimit 16
>>
>> Prefork works by spawning one process to handle one connection. So
>> here, Apache can spawn a maximum of 150 httpd processes (MaxClients  
>> is
>> maximum number of concurrent connections, which in prefork works out
>> to number of processes).
>>
>>> I think I got confused between the terms - server, process and
>>> thread. If
>>> prefork is a single thread process, what does that ThreadsPerChild
>>> mean for
>>> prefork?
>>
>> Prefork is not threaded, so the thread config values do not apply.
>>
>>> Lets say, I wan't to support 250 active sessions logged into my
>>> site, what would be a tentative settings to meet the load?
>>
>>
>> "Active sessions" is difficult to measure. Let's say a person  
>> requests
>> a page which takes 10 seconds, then looks at it for 20 seconds (on
>> average). This means that you need one httpd process for three users
>> (the other two people using the 20 seconds the first user isn't  
>> using).
>>
>> So to get 250 users from these assumptions, we need MaxClients 74.
>>
>> I would use "siege" to measure your performance. It has settings for
>> how many concurrent users, and can attempt to simulate randomness and
>> "user is reading the page" time.

Doug Bell -- Senior Developer, Plain Black Corp.
[ http://plainblack.com ]




---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message