Gracefully stopping varnish

Hugues Alary hugues at betabrand.com
Wed Oct 18 18:22:48 UTC 2017


Hi,

That is indeed what I want to do. Draining connections at the LB level just
involves more work ;).

For context: my entire stack runs on a kubernetes cluster.

I sometime need to replace a running instance of a server process [be it
nginx apache php-fpm varnish whatever] with a new instance.

Taking Apache as an example, I simply create the new apache instance (a new
pod in kubernetes speak), which immediately starts getting some traffic
(without changing the load balancer configuration at all, a kubernetes
"service" automatically detects new pods), then I gracefully shutdown the
old instance (kubernetes actually automatically tells the pod to shutdown),
by issuing a "apachectl -k graceful-stop" (kubernetes is configured to
issue this command for me), which instructs apache to stop accepting
connections, finish, then shutdown.

It's really great because instead of having to push a new config refusing
probes and reload it, I (/kubernetes) simply gracefully stops apache and
the traffic flows to the new instance. nginx and php-fpm also handle things
this way.

At any rate, thanks for the advice, I will start using probes!

Cheers,
-Hugues



On Tue, Oct 17, 2017 at 11:51 PM, Guillaume Quintard <
guillaume at varnish-software.com> wrote:

> Hi,
>
> That's not possible. However, what you really want, I think, is not
> sending new requests to Varnish. That's usually done at the loa-bbalancing
> level. If your LB use probes, you can tell Varnish to stop honoring them,
> drain the connections,  then kill it.
>
> --
> Guillaume Quintard
>
> On Oct 18, 2017 02:28, "Hugues Alary" <hugues at betabrand.com> wrote:
>
>> Hi there,
>>
>> I've been looking around and I can't find a documented way of gracefully
>> shutting down varnishd, and by gracefully I mean tell varnish "stop
>> accepting connections, but finish what you were doing, then shutdown".
>>
>> I did find something in the "first varnish design notes" (
>> https://varnish-cache.org/docs/5.1/phk/firstdesign.html) which seemed to
>> indicate that sending SIGKILL/SIGTERM would mean "suspend/stop" but KILL
>> doesn't seem to work, and TERM, well... terminates but not gracefully.
>>
>> I also tried using "varnishadm stop", which also doesn't gracefully stops
>> connection.
>>
>> Is there anyway to achieve this?
>>
>> Thanks!
>> -Hugues
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20171018/32a20644/attachment.html>


More information about the varnish-misc mailing list