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

前端 未结 2 1301
难免孤独
难免孤独 2021-02-04 18:28

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,

相关标签:
2条回答
  • 2021-02-04 19:11

    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.

    0 讨论(0)
  • 2021-02-04 19:30

    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.

    0 讨论(0)
提交回复
热议问题