Thanks again, Amos.

>Then Squids behaviour already matches your requirements. The "or when timeout 
>occurs" is shutdown_lifetime and you do not have to do anything.

I'm confused by this. After issuing the first shutdown command, my desired 
behavior is for Squid to shut itself down fully as soon as it detects that 
there is no more client activity. My understanding from your first response is 
that Squid will always wait the full timeout, regardless of whether activity 
seems to have stopped.

Ultimately, I ended up having to implement something custom anyway.

My clients have multiple persistent WebSocket connections to different 
services. Some of those services are critical, and some are not. Shutdown must 
be postponed until there are no more active connections to critical services. 
Connections to the non-critical services can last a very long time, and I don't 
want to postpone shutdown because of those connections.
 
To get my desired behavior, I ended up polling 
'cache_object://cache.host.name/active_requests' to check if any critical 
requests are active, and if not, then I issue the shutdown command.

The tricky thing is that 'cache_object' cannot be queried after the first 
shutdown command has been issued, because Squid does not accept any new 
connections. Therefore, I had to find a way to prevent new client connections, 
while still allowing 'cache_object' to keep working. I was able to accomplish 
this by modifying squid.conf and issuing a 'reconfigure'.  Thankfully, the 
'reconfigure' which prevents new client connections does not seem to break any 
of the active WebSocket connections.

So, here is my shutdown sequence:

1.) Modify config file to prevent new client connections and 'reconfigure'.
2.) Poll active requests until there are no connections to critical services.
3.) Issue the shutdown command with a small value for shutdown_lifetime.

Does that sounds reasonable?
_______________________________________________
squid-users mailing list
squid-users@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-users

Reply via email to