Skip to content

perf(health): kill the 5s cold-start tax — no initial_delay default + fast-start probing - #143

Merged
sylvesterdamgaard merged 1 commit into
mainfrom
feat/fast-start-probing
Sep 8, 2026
Merged

perf(health): kill the 5s cold-start tax — no initial_delay default + fast-start probing#143
sylvesterdamgaard merged 1 commit into
mainfrom
feat/fast-start-probing

Conversation

@sylvesterdamgaard

Copy link
Copy Markdown
Contributor

Benchmarking the images against the field surfaced that cold start was dominated by ONE thing: the health monitor slept a silent initial_delay default of 5s before its first probe, so the php-fpm → nginx dependency gate waited out the delay even though php-fpm listens ~50ms after start.

Changes

  1. No more initial_delay default. Unset now means probe immediately; an explicitly configured delay is honored unchanged.
  2. Fast-start probing. Until the first successful check after (re)start, probe every 100ms instead of the steady-state period. Failure semantics are untouched: at most one failure is counted (and emitted) per period — the extra discovery probes are silent — so a never-up process goes unhealthy on exactly the old schedule. Rearm() re-opens the window so restarted instances get the same fast discovery.

Measured (php-baseimages benchmark, 2 CPU / 1 GiB)

before after
php-fpm ready → nginx start 4.95 s 0.20 s
container start → first HTTP 200 (median of 30) 6.15 s 1.33 s

Field context: ServerSideUp 1.2s, DIY fpm+nginx 1.8s, webdevops 2.1s — this moves cbox from last place to the front pack.

New test: a service that starts listening 600ms after the monitor is discovered in <1s (previously one full period). Existing threshold/liveness tests pass unchanged. gofmt/vet/lint/full suite green.

…fast-start probing

Two changes that together took the php-fpm -> nginx dependency gate from
4.95s to 0.20s, and whole-container cold start (start -> first HTTP 200)
from 6.15s to 1.33s median over 30 runs on the php-baseimages benchmark:

1. initial_delay no longer defaults to 5 seconds. The silent default made
   every monitor sleep 5s before its FIRST probe, so readiness waited out
   the delay even though php-fpm listens ~50ms after start. Unset now
   means probe immediately; an explicit initial_delay is honored.

2. Fast-start probing: until the first successful check after (re)start,
   probe every 100ms instead of the steady-state period. Failure semantics
   are unchanged - at most one failure is counted (and emitted) per
   period, the extra discovery probes are silent - so a never-up process
   is declared unhealthy on exactly the old schedule, while readiness is
   discovered within one probe interval. Rearm() gives restarted
   instances the same fast discovery.

New test: a service listening 600ms after monitor start is discovered in
<1s (was: one full period). Full suite, vet, gofmt, lint green.
@sylvesterdamgaard
sylvesterdamgaard merged commit ec9815c into main Sep 8, 2026
9 checks passed
@sylvesterdamgaard
sylvesterdamgaard deleted the feat/fast-start-probing branch September 8, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant