FU: Add randomized --max-reqs option
This commit is contained in:
parent
29dd09e809
commit
8dca0a22a9
1 changed files with 12 additions and 4 deletions
16
FU.pm
16
FU.pm
|
|
@ -507,7 +507,7 @@ sub _spawn {
|
|||
$c{proc} = $1 if /^--proc=([0-9]+)$/;
|
||||
$c{monitor} = 1 if /^--monitor$/;
|
||||
$c{monitor} = 0 if /^--no-monitor$/;
|
||||
$c{max_reqs} = $1 if /^--max-reqs=([0-9]+)$/;
|
||||
$c{max_reqs} = $1 if /^--max-reqs=([0-9]+(?::[0-9]+)?)$/;
|
||||
debug 1 if /^--debug$/;
|
||||
debug 0 if /^--no-debug$/;
|
||||
$ENV{FU_LOG_FILE} = $1 if /^--log-file=(.+)$/;
|
||||
|
|
@ -553,6 +553,7 @@ sub _spawn {
|
|||
_supervisor \%c;
|
||||
} else {
|
||||
$c{supervisor_sock}->syswrite('r'.pack 'V', $$) if $c{supervisor_sock};
|
||||
$c{max_reqs} = $1 >= $2 ? $1 : $1 + int rand $2-$1 if $c{max_reqs} =~ /^([0-9]+):([0-9]+)$/;
|
||||
_run_loop \%c;
|
||||
}
|
||||
}
|
||||
|
|
@ -1387,12 +1388,19 @@ significant cost in performance - better not enable this in production.
|
|||
|
||||
=item FU_MAX_REQS=n
|
||||
|
||||
=item FU_MAX_REQS=min:max
|
||||
|
||||
=item --max-reqs=n
|
||||
|
||||
=item --max-reqs=min:max
|
||||
|
||||
Worker processes can automatically restart after handling a number of requests.
|
||||
Set to 0 (the default) to disable this feature. This option can be useful when
|
||||
your worker processes keep accumulating memory over time. A little pruning now
|
||||
and then can never hurt.
|
||||
Set to 0 (the default) to disable this feature. When set as C<min:max>, the
|
||||
number of requests is randomized in the given range, which is useful to avoid
|
||||
restarting all worker processes around the same time.
|
||||
|
||||
This option can be useful when your worker processes keep accumulating memory
|
||||
over time. A little pruning now and then can never hurt.
|
||||
|
||||
=item FU_DEBUG=0/1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue