Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

Don't forget to coordinate your fcgi settings with your apache worker settings. I usually keep more apache workers around than fcgi workers... they are lighter weight and will wait for an available fcgi worker to free up to process the request if the concurrency reaches higher than my maxspare.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top