Plack::Middleware::Restart: Zero‑downtime migration on Starman vs. Cherokee
0 reputation · 22 Dec 2022, 15:15 UTC
Plack::Middleware::Restart: Zero‑downtime migration on Starman vs. Cherokee
The goal is to upgrade a small PSGI web application without dropping any active connections. Plack::Middleware::Restart achieves this by spawning a child process, keeping the listening socket open, and swapping parent and child. However, the middleware’s behavior depends on the underlying PSGI server’s graceful‑shutdown support.
Starman natively supports graceful shutdown, allowing the middleware to maintain connections during restart. Cherokee, on the other hand, requires explicit configuration to keep sockets open; otherwise, active connections are terminated immediately, defeating the zero‑downtime objective.
Additionally, the middleware relies on Perl 5.10+ for lexical signal handling and Plack 1.4+ for socket transfer APIs. Older servers or versions may lack the necessary hooks, leading to unpredictable behavior.
Unresolved decisions and questions:
- Will the current PSGI server (Starman or Cherokee) correctly preserve listening sockets during a Plack::Middleware::Restart trigger?
- What configuration changes, if any, are required on Cherokee to emulate Starman’s graceful shutdown behavior?
- How can in‑memory state be reliably preserved across the restart when using this middleware?