Safeguard
Developer Tools•

How long should a canary run before you promote a patch?

A canary should run long enough to see representative traffic and slow failures, not a fixed number of minutes. How to set size and duration for a patch.

Safeguard Security Team
4 min read

A canary should run until it has seen enough representative traffic to compare against the control, and long enough to cover slow failure modes such as memory growth, scheduled jobs and cache expiry. For many services that means at least one full traffic cycle, but the right length depends on your traffic and your risks.

What the guidance actually says

Google SRE Workbook describes canarying as deploying to a much smaller subset of production and comparing it with a control portion, effectively an A/B process. It says a canary should be sizeable and last long enough to be representative, and that stopping after a handful of queries gives little signal for systems with diverse requests. It also notes that the higher the processing rate, the less time is required.

That gives you two knobs, size and duration, and a rule: they trade off. A larger canary reaches a given sample sooner. A smaller canary needs more time.

Martin Fowler describes the same release pattern as rolling a change to a small subset of users first and, if problems appear, routing users back to the old version.

Set the duration from three things

  1. Sample size. How many requests, jobs or sessions must the new version handle before a difference in error rate would be visible? Rare endpoints need more time than hot ones.
  2. Traffic shape. If your load has a daily peak, a canary that never sees the peak has not been tested at it. If a weekly batch job uses the patched library, the canary must include a run of that job.
  3. Failure speed. Leaks, connection pool exhaustion and certificate or token expiry show up late. If the patched component holds state or connections, extend the window.
Patched componentLikely slow failureExtend the bake to cover
HTTP or database clientConnection leaks, pool exhaustionSeveral pool lifetimes
Cache or session libraryEviction and expiry behaviorOne full expiry cycle
Scheduler or queue libraryFailures only when a job firesOne run of each job
Parser or serializerRare malformed inputEnough volume to see rare inputs

A staged plan you can adapt

  1. Deploy to a small slice and confirm health checks and a smoke test.
  2. Hold, and compare the new version's error rate, latency and resource use with the control, per version and not as a global average.
  3. Step up the share in stages, holding at each stage for the agreed window.
  4. Promote to everyone only after the window that covers your peak and your scheduled jobs.
  5. Keep the old version deployable for a defined period after promotion.

Compare per version. The SRE material points out that a small canary population is diluted in overall traffic, so a global error rate can hide a real problem, while a per-version breakdown makes it plain.

Kubernetes Deployments support rolling updates and a minimum ready time per pod, which delays marking a new pod available. That is useful for catching early crashes, but it is not a canary by itself because it does not compare against a control by default. See also canary release metrics for security regressions.

When to shorten it

An actively exploited vulnerability changes the trade. Shrink the window, keep the per-version comparison, and keep a fast rollback. Write down that you shortened it and why.

Quick check

Is one hour enough for a canary?

Sometimes, for a high traffic stateless service and a small change. It is not enough if the change touches a component with slow failures or a job that runs daily or weekly.

Should the canary use real user traffic?

Yes, in a staged way. Real traffic exposes inputs that tests do not, which is the point of a canary.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.