nginx have directives like httpd's MaxRequestsPerChild

Valentin V. Bartenev vbart at
Sat Oct 11 10:13:55 UTC 2014

On Saturday 11 October 2014 11:57:47 MerKer Xu wrote:
> hi there, does nginx have directives like apache's MaxRequestsPerChild?
> Description: Limit on the number of requests that an individual child server will handle during its life
> Syntax:    MaxRequestsPerChild number
> I only found nginx's worker_connections directive,  they are quite different!
> Is there a similar one? or why nginx doesn't need it?
> Many thanks!

There are at least three arguments that I think make it a low priority:

 1. Memory or socket leaks in nginx are something rare and usually considered as a
    serious bug (note also, that Apache has mod_php and friends, which often suffer
    from leaks);

 2. Each worker process in Apache handles only one connection at a time, while nginx
    workers are able (and usually do) to handle millions of long lived connections
    simultaneously.  So restarting an nginx worker without requests loss isn't a
    trivial task and can consume significant time;


 3. Such functionality (if needed) can be easily implemented even with much more power
    using cron and/or some scripts, since nginx supports reloading and upgrading without
    interruption of the client servicing.

    And because nginx usually has only a few workers, reloading all of them at the same
    time isn't painful.


 wbr, Valentin V. Bartenev

More information about the nginx mailing list