On 12/6/21 4:58 PM, Yann Ylavic wrote:
> On Mon, Dec 6, 2021 at 3:27 PM Yann Ylavic <ylavic....@gmail.com> wrote:
>>
>> 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.
> 
> Argh no sorry for the babbling (we don't want to maintain N potential
> restarts all the time, one is enough, more is at the admin's
> discretion depending on the workflow..).
> 
> If we want to stop killing processes to keep a reserve of
> active_daemons_limit for a potential graceful restart, the condition
> might be:
>   int do_kill = (retained->total_daemons == retained->active_daemons
>                  || (server_limit - retained->total_daemons >
>                      active_daemons_limit));
> 
> But after all it might not be your concern nor your priority..

This is fine. Maybe the large headroom is a good idea for people that complain 
about the change in behavior and as you state, a
large scoreboard should not be too costly these days. Hence +1 to the 
additional condition.

Regards

RĂ¼diger

Reply via email to