On Mon, Dec 6, 2021 at 1:53 PM Ruediger Pluem <rpl...@apache.org> wrote:
>
> On 12/6/21 1:33 PM, Yann Ylavic wrote:
> >
> > How about (modulo brain fart):
> >     const int N = 1; /* or 2, 3, 4.. */
> >     int avail_daemons = server_limit - retained->total_daemons;
> >     int have_room_for_N_restarts = (avail_daemons / N >= 
> > active_daemons_limit);
> >     int inactive_daemons = retained->total_daemons - 
> > retained->active_daemons;
> >     int do_kill = (have_room_for_N_restarts || inactive_daemons == 0);
> >     if (do_kill) {
> >         ap_mpm_podx_signal(retained->buckets[child_bucket].pod,
> >                            AP_MPM_PODX_GRACEFUL);
> >     }
> >     else {
> >         /* Wait for inactive_daemons to settle down */
> >     }
> > ?
> >
>
> Not sure if it is worth it as I think that have_room_for_N_restarts will only 
> rarely be true.

You are right if "server_limit < 2 * active_daemons_limit" but I don't
think it's a "reasonable" configuration, I wouldn't mind serializing
kills (i.e. inactive_daemons == 0) in this case to avoid "Scoreboard
is full" issues on a "loady" restart, all the more with slow-to-exit
processes (asynchronous, huge timeouts connections). Scoreboard is
quite cheap in (shared-)memory space, "ServerLimit >= 5 *
active_daemons_limit" is not what will eat system memory..

So if we take "N = server_limit / active_daemons_limit", the above
looks like something that could work for killing processes >
MaxSpareThreads faster (even though I don't find it necessarily
helpful personally) with a "reasonable" configuration.


Cheers;
Yann.

Reply via email to