Deployment Ring Pattern
Roll out changes progressively in rings of increasing size. Start with a small group, verify health, then expand to larger rings before full deployment.
Overview
A production deploy starts failing for 4% of requests, but only a few hundred users ever see it because the release never left the first rollout ring — the failure this pattern exists to contain.
The Deployment Ring Pattern ships a new version through concentric rings of increasing size. A typical setup starts with internal users at 1% (ring 0), moves through early adopters at 5% (ring 1) and a random quarter of traffic (ring 2), then opens up to everyone at 100%. Between rings, the system checks health metrics: error rate, latency, conversion. If metrics degrade, the rollout stops and rolls back. When they hold, the rollout moves to the next ring.
The effect is a smaller blast radius: a bug that would hit every user in a full deployment only touches the fraction of traffic inside the current ring, which is 1% in ring 0. Microsoft has shipped Windows, Office and Azure updates this way for years — internal rings first, then progressively wider audiences. By the time a version reaches 100%, it’s already survived contact with progressively larger and more diverse traffic.
When to Use
Use the Deployment Ring Pattern when:
- You ship changes that carry real risk: new functionality, schema changes, infrastructure updates
- You need validation against real traffic before committing to a full rollout
- You want rollback to be automatic when health degrades, not a human decision under pressure
- Your user base is large enough to segment meaningfully
- Typical candidates: SaaS platforms, public APIs, mobile app updates, microservice fleets
It’s a poor fit when:
- The base is too small to segment. A 1% ring of 300 users is three people and produces no statistical signal — a plain canary release is enough at that scale.
- Every request mutates shared state you can’t revert. Rolling back a ring doesn’t un-migrate a schema; if the new version writes data the old version can’t read, rings buy you nothing.
- There’s no way for the old and new versions to coexist (a breaking API change with both consumer groups hitting the same endpoints). You need versioning or a blue-green cutover instead.
Solution
The same minimal ring deployer in three languages. Each one plays out the same scenario: the mock health check passes twice, fails on ring 2, and you watch the completed rings roll back.
Python
from dataclasses import dataclass, field
from typing import Callable, List, Optional, Dict
from enum import Enum
import time
class RingStatus(Enum):
PENDING = "pending"
ACTIVE = "active"
COMPLETED = "completed"
ROLLED_BACK = "rolled_back"
FAILED = "failed"
@dataclass
class Ring:
ring_id: int
name: str
percentage: float
status: RingStatus = RingStatus.PENDING
started_at: Optional[float] = None
completed_at: Optional[float] = None
health_check_passed: bool = False
@dataclass
class HealthMetrics:
error_rate: float
p95_latency_ms: float
success_rate: float
def is_healthy(self, max_error_rate: float = 0.05, max_p95: float = 500) -> bool:
return self.error_rate < max_error_rate and self.p95_latency_ms < max_p95
class RingDeployment:
def __init__(self, version: str, rings: List[Ring],
health_check_fn: Callable[[], HealthMetrics],
max_error_rate: float = 0.05, max_p95: float = 500,
bake_time_seconds: float = 2.0):
self.version = version
self.rings = rings
self.health_check_fn = health_check_fn
self.max_error_rate = max_error_rate
self.max_p95 = max_p95
self.bake_time = bake_time_seconds
self.current_ring_idx = 0
def _deploy_to_ring(self, ring: Ring) -> bool:
ring.status = RingStatus.ACTIVE
ring.started_at = time.time()
print(f" Deploying v{self.version} to {ring.name} ({ring.percentage}% of users)")
time.sleep(self.bake_time)
metrics = self.health_check_fn()
ring.health_check_passed = metrics.is_healthy(self.max_error_rate, self.max_p95)
print(f" Health: error_rate={metrics.error_rate:.2%}, p95={metrics.p95_latency_ms}ms, success={metrics.success_rate:.2%}")
if ring.health_check_passed:
ring.status = RingStatus.COMPLETED
ring.completed_at = time.time()
print(f" PASS - Ring {ring.ring_id} completed")
return True
else:
ring.status = RingStatus.FAILED
print(f" FAIL - Ring {ring.ring_id} failed health check, rolling back")
return False
def execute(self) -> Dict:
print(f"\n=== Ring Deployment: v{self.version} ===")
for i, ring in enumerate(self.rings):
self.current_ring_idx = i
success = self._deploy_to_ring(ring)
if not success:
self._rollback()
return {"version": self.version, "status": "rolled_back",
"failed_ring": ring.ring_id, "rings_completed": i}
print(f"\nAll rings completed. v{self.version} is live for 100% of users.")
return {"version": self.version, "status": "completed",
"rings_completed": len(self.rings)}
def _rollback(self) -> None:
for ring in self.rings:
if ring.status == RingStatus.COMPLETED:
ring.status = RingStatus.ROLLED_BACK
print(f" Rolling back ring {ring.ring_id} ({ring.name})")
# Usage
call_count = 0
def mock_health_check() -> HealthMetrics:
global call_count
call_count += 1
if call_count == 3:
return HealthMetrics(error_rate=0.08, p95_latency_ms=600, success_rate=0.92)
return HealthMetrics(error_rate=0.01, p95_latency_ms=120, success_rate=0.99)
rings = [
Ring(ring_id=0, name="internal", percentage=1.0),
Ring(ring_id=1, name="early-adopters", percentage=5.0),
Ring(ring_id=2, name="canary", percentage=25.0),
Ring(ring_id=3, name="general", percentage=100.0),
]
deployment = RingDeployment(
version="2.1.0", rings=rings, health_check_fn=mock_health_check,
max_error_rate=0.05, max_p95=500, bake_time_seconds=0.5,
)
result = deployment.execute()
print(f"\nResult: {result}")
JavaScript
class RingDeployment {
constructor(version, rings, healthCheckFn, options = {}) {
this.version = version;
this.rings = rings;
this.healthCheckFn = healthCheckFn;
this.maxErrorRate = options.maxErrorRate ?? 0.05;
this.maxP95 = options.maxP95 ?? 500;
this.bakeTimeMs = options.bakeTimeMs ?? 2000;
}
async _deployToRing(ring) {
ring.status = "active";
ring.startedAt = Date.now();
console.log(` Deploying v${this.version} to ${ring.name} (${ring.percentage}% of users)`);
await new Promise(r => setTimeout(r, this.bakeTimeMs));
const metrics = this.healthCheckFn();
ring.healthCheckPassed = metrics.errorRate < this.maxErrorRate && metrics.p95LatencyMs < this.maxP95;
console.log(` Health: error_rate=${(metrics.errorRate * 100).toFixed(1)}%, p95=${metrics.p95LatencyMs}ms`);
if (ring.healthCheckPassed) {
ring.status = "completed";
console.log(` PASS - Ring ${ring.ringId} completed`);
return true;
}
ring.status = "failed";
console.log(` FAIL - Ring ${ring.ringId} failed, rolling back`);
return false;
}
async execute() {
console.log(`\n=== Ring Deployment: v${this.version} ===`);
for (let i = 0; i < this.rings.length; i++) {
const success = await this._deployToRing(this.rings[i]);
if (!success) {
this._rollback();
return { version: this.version, status: "rolled_back", failedRing: this.rings[i].ringId, ringsCompleted: i };
}
}
console.log(`\nAll rings completed. v${this.version} is live for 100% of users.`);
return { version: this.version, status: "completed", ringsCompleted: this.rings.length };
}
_rollback() {
for (const ring of this.rings) {
if (ring.status === "completed") {
ring.status = "rolled_back";
console.log(` Rolling back ring ${ring.ringId} (${ring.name})`);
}
}
}
}
// Usage
let callCount = 0;
const mockHealthCheck = () => {
callCount++;
if (callCount === 3) return { errorRate: 0.08, p95LatencyMs: 600, successRate: 0.92 };
return { errorRate: 0.01, p95LatencyMs: 120, successRate: 0.99 };
};
const rings = [
{ ringId: 0, name: "internal", percentage: 1.0, status: "pending" },
{ ringId: 1, name: "early-adopters", percentage: 5.0, status: "pending" },
{ ringId: 2, name: "canary", percentage: 25.0, status: "pending" },
{ ringId: 3, name: "general", percentage: 100.0, status: "pending" },
];
(async () => {
const deployment = new RingDeployment("2.1.0", rings, mockHealthCheck,
{ maxErrorRate: 0.05, maxP95: 500, bakeTimeMs: 100 });
const result = await deployment.execute();
console.log(`\nResult:`, result);
})();
Java
import java.util.*;
public class RingDeployment {
record Ring(int ringId, String name, double percentage, String status, boolean healthCheckPassed) {
Ring withStatus(String s) { return new Ring(ringId, name, percentage, s, healthCheckPassed); }
Ring withHealth(boolean h) { return new Ring(ringId, name, percentage, status, h); }
}
record HealthMetrics(double errorRate, double p95LatencyMs, double successRate) {
boolean isHealthy(double maxError, double maxP95) {
return errorRate < maxError && p95LatencyMs < maxP95;
}
}
private final String version;
private final List<Ring> rings;
private final java.util.function.Supplier<HealthMetrics> healthCheckFn;
private final double maxErrorRate;
private final double maxP95;
public RingDeployment(String version, List<Ring> rings,
java.util.function.Supplier<HealthMetrics> healthCheckFn,
double maxErrorRate, double maxP95) {
this.version = version; this.rings = rings;
this.healthCheckFn = healthCheckFn; this.maxErrorRate = maxErrorRate; this.maxP95 = maxP95;
}
private boolean deployToRing(Ring ring) {
System.out.printf(" Deploying v%s to %s (%.1f%%)%n", version, ring.name(), ring.percentage());
try { Thread.sleep(100); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
HealthMetrics m = healthCheckFn.get();
boolean healthy = m.isHealthy(maxErrorRate, maxP95);
System.out.printf(" Health: error_rate=%.2f%%, p95=%.0fms%n", m.errorRate() * 100, m.p95LatencyMs());
if (healthy) { System.out.printf(" PASS - Ring %d completed%n", ring.ringId()); return true; }
System.out.printf(" FAIL - Ring %d failed, rolling back%n", ring.ringId());
return false;
}
public Map<String, Object> execute() {
System.out.printf("%n=== Ring Deployment: v%s ===%n", version);
for (int i = 0; i < rings.size(); i++) {
if (!deployToRing(rings.get(i))) {
rollback();
return Map.of("version", version, "status", "rolled_back", "failedRing", rings.get(i).ringId(), "ringsCompleted", i);
}
}
System.out.printf("%nAll rings completed. v%s is live for 100%%.%n", version);
return Map.of("version", version, "status", "completed", "ringsCompleted", rings.size());
}
private void rollback() {
for (Ring r : rings) {
if (r.status().equals("completed"))
System.out.printf(" Rolling back ring %d (%s)%n", r.ringId(), r.name());
}
}
public static void main(String[] args) {
int[] callCount = {0};
var healthCheck = (java.util.function.Supplier<HealthMetrics>) () -> {
callCount[0]++;
if (callCount[0] == 3) return new HealthMetrics(0.08, 600, 0.92);
return new HealthMetrics(0.01, 120, 0.99);
};
var rings = List.of(
new Ring(0, "internal", 1.0, "pending", false),
new Ring(1, "early-adopters", 5.0, "pending", false),
new Ring(2, "canary", 25.0, "pending", false),
new Ring(3, "general", 100.0, "pending", false)
);
var deployment = new RingDeployment("2.1.0", rings, healthCheck, 0.05, 500);
System.out.println("\nResult: " + deployment.execute());
}
}
Explanation
The deployment proceeds through each ring sequentially:
- Deploy to ring: Route the configured percentage of traffic to the new version. In practice that’s usually feature flag targeting, load balancer weights, or a Kubernetes rollout strategy.
- Bake time: Wait long enough for the ring to accumulate meaningful traffic. Minutes for large rings, hours for a 1% ring — the metric isn’t time, it’s request volume.
- Health check: Compare the ring’s metrics with thresholds fixed before the rollout, so the gate doesn’t move under pressure. Error rate and latency are the floor; business metrics (conversion, signup completion) catch failures that look fine technically.
- Advance or rollback: Pass the gate and the rollout expands to the next ring; fail it, and every completed ring reverts — not just the one that tripped.
Sizing the rings
Ring sizing follows two constraints that pull in opposite directions. The first ring must be big enough to surface real regressions but small enough that a total failure is acceptable — 1% of a large base is typical, though the real floor is statistical: you need roughly a thousand requests inside the bake window before error rates mean anything. The last ring is always 100%; what varies between teams is the middle.
| Base size | Typical rings | Notes |
|---|---|---|
| Under 10k users | 2 (canary ~10% → 100%) | A 1% ring has no signal; a plain canary is simpler |
| 10k–1M users | 3 (1% → 10% → 100%) | Standard shape; add an employees ring if you’ve got one |
| Over 1M users | 4–5 (internal → 1% → 5% → 25% → 100%) | Geographic or tiered variants start paying off |
More than five rings rarely adds safety — each gate costs bake time, and a rollout that takes a week discourages shipping small changes at all.
Worked Example
A payments team ships v2.4.0, which rewrites the retry logic on the checkout path. They configure four rings: 30-minute bakes on rings 0–1, two hours on ring 2.
| Ring | Audience | Bake | Outcome |
|---|---|---|---|
| 0 | Employees (~1%) | 30 min | Healthy: error rate 0.4%, p95 up 8ms. Advances. |
| 1 | Beta opt-ins (5%) | 30 min | Technically healthy, but checkout conversion dips 0.6% — inside the noise band, so it advances with a note to watch conversion. |
| 2 | Random segment (25%) | 2 h | Fails 40 minutes in: error rate on /checkout/confirm hits 6% because the new retry logic doubles a timeout on one payment provider. |
| — | Rollback | Immediate | Rings 0–2 revert to v2.3.9. 25% of traffic, under an hour in total. |
A single-step canary might have missed it (the failure only showed on one provider’s path, at volume), and a full deploy would have hit every customer. The rings turned an incident into a non-event. The fix shipped the next day and passed all four rings with the retry regression gone.
Variants
| Variant | Description | Use Case |
|---|---|---|
| Geographic rings | Roll out by region (US, EU, APAC) | Regional compliance, latency testing |
| User-tier rings | Roll out by plan (free, pro, enterprise) | SaaS with tiered SLAs |
| Time-based rings | Expand the ring automatically over time | Low-risk changes that need minimal oversight |
| Manual approval rings | Require human approval between rings | High-risk changes, compliance requirements |
| Feature-flag rings | Rings defined as flag targeting rules | Teams already on a flag platform; no infra changes needed |
What Works
- Start at 1% or less. The first ring exists to catch the catastrophic, not the subtle — keep it cheap.
- Use real user traffic for health validation. Synthetic checks catch crashes, not the checkout flow degrading only on Safari.
- Set bake times by request volume, not the clock. “1,000 requests in the ring” scales itself; “30 minutes” doesn’t.
- Write rollback criteria down before the rollout starts. Deciding thresholds mid-incident is how teams talk themselves into advancing a sick release.
- Watch a business metric alongside the technical ones. A version can be fast and error-free while quietly breaking signups.
- Keep the previous version warm. If rolling back means rebuilding first, you’re looking at an hour of downtime, not minutes.
Common Mistakes
- Skipping bake time or shrinking it because the first rings looked fine — the interesting failures live in the big rings
- Gating only on technical metrics and missing the version that’s healthy but quietly drops conversions
- Rings too large: going from 5% straight to 100% is a canary, not a ring deployment
- No automated rollback, so “rollback” really means someone SSH-ing in during an incident
- Rolling back only the failed ring and leaving earlier rings stranded on the new version
- Never testing the rollback path — the first real rollback is a bad time to discover it doesn’t work
- Announcing the release externally while it’s still in a middle ring and can still be pulled
See Also
- Canary Release Pattern — the single-step version of this pattern
- Deployment Strategies Guide — where rings fit among rolling, blue-green and canary strategies
- Deployment Rollback Runbook — the operational runbook for the rollback this pattern triggers
- Feature Flags recipe — the most common mechanism for routing users into rings
- Microsoft — Phase rollout with rings — how Azure DevOps ships with deployment rings
- Google SRE Workbook — Canarying Releases — the health-gate math behind staged rollouts
- Martin Fowler — CanaryRelease — the foundational bliki entry on staged exposure
- Companion repo — runnable ring deployment example
Frequently Asked Questions
How is ring deployment different from canary release?
A canary release is one step: route a small percentage, watch it, then go to 100%. Ring deployment repeats that step several times — concentric rings of increasing size, each with its own health gate. It's more granular control, yes, but it takes longer. Think of rings as layers of safety: each one verifies before the next.
How long should the bake time be?
Long enough for the ring to collect statistically significant health data. For 1% of traffic that can mean hours; for 25%, minutes. Practical rule: don't evaluate a ring until it's served at least a thousand requests on the paths that matter to you.
What metrics should gate each ring?
Error rate and latency are the minimum gate. But also add the business metric your app actually lives on — conversion, checkout completion, signups. A version that's technically healthy but drops conversions shouldn't advance. Pick the metric your business lives on and gate on it.
Can I skip rings for low-risk changes?
Yes. For trivial changes (copy updates, CSS fixes) starting at a larger ring is reasonable. For high-risk ones (schema migrations, new dependencies) start at the smallest ring. Match the entry point to the risk, not the calendar.
How many rings should a deployment have?
Three to four covers most teams: internal, small external, mid-size, then 100%. Past five, each extra gate costs bake time and delays every release without buying much additional safety. More rings mean more verification steps, not necessarily more safety.
What happens if a late ring fails after earlier ones passed?
Roll back all completed rings, not just the one that failed. Earlier rings passing doesn't protect later ones — a 25% ring exposes users the 5% ring never reached, and leaving them on the new version splits your production state. That's the trade-off: more rings = more safety, but also more complex rollback.
Related Resources
Canary Release Pattern
Route a small percentage of traffic to the new version while the rest stays on stable. Monitor health metrics and gradually increase or roll back based on results.
PatternBlue-Green Deployment Pattern
Catalog entry for the blue-green deployment pattern: the problem it solves, its traffic-switch mechanism, trade-offs, and when to choose it.
GuideDeployment Strategies Compared: Blue-Green, Canary, Rolling
A practical guide to deployment strategies: rolling, blue-green, canary, shadow and feature flags. Minimize risk and rollback time when releasing to production.
DocDeployment Rollback Runbook
Runbook for rolling back failed deployments: triggers, kubectl/Helm/ArgoCD commands, database migration rollback, and verification checklists.
RecipeCanary Deployments with Istio Service Mesh
How to use Istio traffic splitting to perform safe canary deployments by gradually shifting user traffic between application versions
RecipeFeature Flags: Rollout, Targeting, and Safe Rollback
Implement feature toggles to roll out, test, and revert functionality safely without redeploying code.