Self-Host Ops Journal

Measuring dropped requests during a deploy with a simple load loop

"Zero downtime" is easy to claim and easy to measure. Before trusting any deploy setup, run a load loop against it during a real deploy and count the failures.

The loop

end=$((SECONDS+120)); ok=0; bad=0
while [ $SECONDS -lt $end ]; do
  code=$(curl -s -o /dev/null -w '%{http_code}' -m 5 https://app.example.com/healthz)
  if [ "$code" = "200" ]; then ok=$((ok+1)); else bad=$((bad+1)); echo "$(date +%T) $code"; fi
  sleep 0.2
done
echo "ok=$ok bad=$bad"

Start it, trigger a deploy, and read the output. Every non-200 line has a timestamp, so you can line it up with the deploy log.

Test a real page too

Health endpoints are cheap. Add a second loop against a page that touches the database, because failures often come from connection pools that are not ready yet.

Use a load tool for concurrency

A single curl loop sends one request at a time. Tools like hey or k6 send many in parallel and catch errors that only appear under load, such as the old container refusing new connections while it drains:

hey -z 120s -c 20 https://app.example.com/

What the results usually show

Keep it in CI

Run the loop against staging on every deploy and fail the pipeline if bad is above zero.

A longer guide to zero-downtime deployments on a VPS covers the setups that pass this test. I work on Peon, an open-source self-hosted deployment platform.