Re: Using "shutdown sessions server" through master socket

2024-12-03 Thread Jens Wahnes

Hi Valentine,

thank you for looking into this and sharing your thoughts. I'm not sure 
if these questions were directed at me:


Valentine Krasnobaeva wrote:
cli_find_server() is used in all CLI command handlers, which manipulates 
servers. So, let's discuss this use-case, if there is a willingnessto 
have such small feature ?


If there is a willingness, I would need to check other "server" 
commands, as with this simple patch below, which unblocks, we probably 
break some other cases.


I have a workaround that yields the desired outcome for my current use 
case, that is to close down the open websocket connections in question. 
I can live with that, even though I would find using a single command 
more elegant.


If nobody but me wants to use the "shutdown sessions server" command on 
soft-closed haproxy processes, then it's probably not worth investing 
time in it. What I can contribute to this would be my willingness to try 
it out and do some tests, but my skills in C programming are not good 
enough to either contribute code or to check which other "server" 
commands would need additional attention.



Jens



Re: Using "shutdown sessions server" through master socket

2024-11-27 Thread Valentine Krasnobaeva

Hello,

As for configuration, yes, as Lukas pointed,  "hard-stop-after" is a 
right setting, it was designed specifically for such case of long 
connections.


If master-worker mode is used, there is also "mworker-max-reloads", 
which can help.


https://docs.haproxy.org/3.0/configuration.html#3.1-mworker-max-reloads

Basically, you need to set "mworker-max-reloads" as some small value N 
(2-3 times). If the old worker hasn't quit up to N reloads, master 
process will send a SIGTERM to it during the next reload (N+1). It could 
be handy to control the old worker processes number.


It can be used in combination with "hard-stop-after".


--
Bien cordialement,
Valentine





Re: Using "shutdown sessions server" through master socket

2024-11-19 Thread Jens Wahnes

Lukas Tribus wrote:

take a look at the hard-stop-after configuration:

https://docs.haproxy.org/3.0/configuration.html#3.1-hard-stop-after 


Thank you for this pointer. Actually, I thought about using 
"hard-stop-after", but it does not really do what I would like (shut 
down old sessions at convenient time, and only should it become 
necessary). So this is a nice additional alternative, but does not 
really answer the question about "shutdown sessions server".



Jens




smime.p7s
Description: Kryptografische S/MIME-Signatur


Re: Using "shutdown sessions server" through master socket

2024-11-19 Thread Lukas Tribus
Hello,

On Tuesday, 19 November 2024, Jens Wahnes  wrote:

> Lukas Tribus wrote:
>
>> take a look at the hard-stop-after configuration:
>>
>> https://docs.haproxy.org/3.0/configuration.html#3.1-hard-stop-after
>>
>
> Thank you for this pointer. Actually, I thought about using
> "hard-stop-after", but it does not really do what I would like (shut down
> old sessions at convenient time, and only should it become necessary). So
> this is a nice additional alternative, but does not really answer the
> question about "shutdown sessions server".


>


You could just hard stop the process (you are already aware of the PID
anyway), but you only want to do it for a specific backend server, which
makes this a uncommon case I guess.

I don't see how rejecting a "shutdown sessions server" command during
soft-stop would make sense so I'd suggest you file a bug on github.

Lukas


Re: Using "shutdown sessions server" through master socket

2024-11-19 Thread Lukas Tribus
Hello,

take a look at the hard-stop-after configuration:

https://docs.haproxy.org/3.0/configuration.html#3.1-hard-stop-after

Lukas