Go in production · 10 min read
Graceful shutdown for a Go HTTP server under systemd
Handle SIGTERM with signal.NotifyContext, drain requests with Server.Shutdown, stop workers cleanly and set TimeoutStopSec so systemd waits long enough.
Writing Go services that run for months on one machine: shutdown, timeouts, memory, logging and systemd.
Go in production · 10 min read
Handle SIGTERM with signal.NotifyContext, drain requests with Server.Shutdown, stop workers cleanly and set TimeoutStopSec so systemd waits long enough.
Go in production · 10 min read
A Go program with 40 MiB of live data was OOM-killed in an 80 MiB container. See what GOMEMLIMIT fixes, what it costs in CPU, and where the limit is soft.
Go in production · 9 min read
Under load, a Go service answered 404 for rows it had just written. How we found it, the regression test that catches it, and what to check in your pool.
Go in production · 10 min read
Configure log/slog with JSON or text output, a runtime log level, request ids on every line, secret redaction, and queries that work in journalctl.
Go in production · 10 min read
Set ReadHeaderTimeout, ReadTimeout, WriteTimeout and IdleTimeout correctly, add per-handler deadlines, and prove a slowloris client gets cut off.