On Thu, Dec 2, 2021 at 5:50 PM Ruediger Pluem <[email protected]> wrote:
>
> On 12/2/21 4:32 PM, Yann Ylavic wrote:
> >
> > Or maybe we could simply:
> > --- server/mpm/event/event.c (revision 1895394)
> > +++ server/mpm/event/event.c (working copy)
> > @@ -3186,8 +3186,8 @@ static void perform_idle_server_maintenance(int ch
> > * requests. If the server load changes many times, many such
> > * gracefully finishing processes may accumulate, filling up the
> > * scoreboard. To avoid running out of scoreboard entries, we
> > - * don't shut down more processes when the total number of
> > processes
> > - * is high, until there are more than max_workers/4 idle threads.
> > + * don't shut down more processes if there are quiescing ones
> > + * already (i.e. retained->total_daemons > active_daemons).
> > *
> > * XXX It would be nice if we could
> > * XXX - kill processes without keepalive connections first
> > @@ -3195,13 +3195,7 @@ static void perform_idle_server_maintenance(int ch
> > * XXX depending on server load, later be able to resurrect them
> > * or kill them
> > */
> > - if ((retained->total_daemons <= active_daemons_limit
> > - && retained->total_daemons < server_limit)
> > - /* The above test won't transition from true to false until a
> > child
> > - * exits by itself (i.e. MaxRequestsPerChild reached), so the
> > below
> > - * test makes sure that the situation unblocks when the load
> > falls
> > - * significantly (regardless of MaxRequestsPerChild, e.g. 0) */
> > - || idle_thread_count > max_workers/4 / num_buckets) {
> > + if (retained->total_daemons == active_daemons) {
>
> Wouldn't this effectively disable shutting down processes until we hit the
> limit even if shrinking is desired far before we reach
> this?
Possibly not because we are still under:
if (idle_thread_count > max_spare_threads / num_buckets)
?
> Example:
>
> MaxRequestWorkers 1000
> ThreadsPerChild 10
> MinSpareThreads 10
> MaxSpareThreads 30
> Serverlimit 105
> StartServers 2
>
> In case the server gets 40 connections in parallel after startup it would
> spin up to 5 processes if it gets idle afterwards it
> would not shutdown children any longer.
We are above MaxSpareThreads in this case so it would trigger as soon
as it gets idle (unless a graceful was asked during the load, but
immediately after all the old gen processes have stopped otherwise).
Regards;
Yann.