Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What values to use for FastCGI maxrequests, maxspare, minspare, maxchildren?

I'm running a Django app using FastCGI and lighttpd.

Can somebody explain me what I should consider when deciding what value to use for maxrequests, maxspare, minspare, maxchildren?

These options are not too well documented, but seem quite important.

Don't just tell me what they do; I want to understand what implications they have and how I should decide on what values to use.

Thanks.

like image 306
ibz Avatar asked Dec 26 '08 08:12

ibz


1 Answers

Let's start with the definition

    maxrequests: How many requests does a child server before being killed 
                 and a new one forked
    maxspare   : Maximum number of spare processes to keep running
    minspare   : Minimum number of spare processes to prefork
    maxchildren: Hard limit number of processes in prefork mode

This means that you'll have at most maxchildren processes running at any given time in your webserver, each running for maxrequests requests. At server start you'll get minspare processes, which will keep growing until maxspare (or maxchildren) if more requests are coming.

So, minspare lets you say how many concurrent requests are you expecting at a minimum (important to avoid the process creation if you start with one, it's good to start at, say 10), and maxspare lets you say how many concurrent requests will your server attend to at most (without compromising it's expected response time and so on. Needs a stress test to validate). And maxrequests is talking about the lifetime of each child, in case they cannot run forever due to any kind of constraint.

like image 137
Vinko Vrsalovic Avatar answered Oct 03 '22 17:10

Vinko Vrsalovic