How to deploy an upgrade (build with rebar3)
Loïc Hoguin
essen@REDACTED
Mon Feb 24 15:28:39 CET 2020
On 24/02/2020 15:15, Fred Hebert wrote:> Another common pattern is going
to see some servers die when their
> acceptor pool crashes for the same reasons -- the acceptors maintain a
> reference to an older module, and following a couple of reloads, they
> get killed all at once in a kind of storm. Ranch, which underpins
> cowboy, is the most frequently seen one doing this as its acceptor pool
> isn't safe (all accept calls wait for infinity
> <https://github.com/ninenines/ranch/blob/ae84436f7ceed06a09e3fe1afb30e675579b7621/src/ranch_acceptor.erl#L35>,
> which as far as I can tell is a performance-based decision); a
> workaround for this is to shrink your acceptor pool to be small enough
> that you can reasonably expect all acceptors to be used between two
> upgrades.
Ranch 2.0 onward fully supports upgrades and comes with an appup you can
use directly: https://github.com/ninenines/ranch/blob/master/src/ranch.appup
We've recently added a test suite:
https://github.com/ninenines/ranch/blob/master/test/upgrade_SUITE.erl
The workaround described is more or less what Ranch 2.0 does during the
upgrade: stop all the acceptor processes, perform the upgrade, resume
the acceptor processes. The listening socket(s) stays open, so no new
connections should be rejected as long as the backlog is large enough,
and existing connections stay alive as well.
Cheers,
--
Loïc Hoguin
https://ninenines.eu
More information about the erlang-questions
mailing list