When your engineering team finishes building a new version of an application, the code is tested, CI pipelines pass, and artifacts are baked into container images. But your production system is not sitting idle. Thousands of active customers are querying databases, streaming websockets, and checking out shopping carts.

Replacing that running application without dropping active TCP connections, corrupting state, or triggering customer support escalations is the foundational challenge of release engineering.

Deploying software into production is not simply copying binaries onto virtual machines or updating image tags in a Kubernetes pod spec. It is about controlling how change reaches real users, isolating failure domains, and having a deterministic recovery mechanism when unexpected edge cases emerge under real traffic.

Depending on your database architecture, infrastructure budget, and risk tolerance, six deployment strategies define modern production systems: Recreate, Rolling, Blue-Green, Canary, Shadow, and A/B Testing.

1. Recreate Deployment (All-At-Once)

The recreate strategy is the simplest deployment pattern possible. You terminate all running instances of version 1, wait for processes to exit, install version 2, and boot the application up.

flowchart LR A["V1 Cluster (Active)"] -->|Shutdown| B["Downtime Window"] B -->|Boot & Warmup| C["V2 Cluster (Active)"]

During the window between when the operating system terminates the old process and when the new process binds to the listening port and passes health checks, incoming HTTP requests have no healthy backend. The load balancer returns 502 Bad Gateway or 503 Service Unavailable.

  • The Trade-Off: Old and new versions never run concurrently. You have zero version drift, meaning database migrations can make breaking changes without backward compatibility concerns.
  • When to Use: Batch workloads, internal developer tools, or services with agreed maintenance windows where brief interruptions are acceptable.

2. Rolling Deployment (Phased Instance Replacement)

In a rolling deployment, the deployment controller takes individual server instances or Kubernetes pods out of the load balancer pool one at a time, drains active connections, deploys the new version, verifies health checks, and reinserts the instance into the routing pool.

flowchart LR subgraph S1["Step 1"] S1A["Server 1: V2"] --- S1B["Server 2: V1"] --- S1C["Server 3: V1"] end subgraph S2["Step 2"] S2A["Server 1: V2"] --- S2B["Server 2: V2"] --- S2C["Server 3: V1"] end subgraph S3["Step 3"] S3A["Server 1: V2"] --- S3B["Server 2: V2"] --- S3C["Server 3: V2"] end S1 --> S2 --> S3

During the rollout, overall cluster capacity remains stable, and customer traffic continues flowing without total application unavailability.

  • The Architectural Catch: Rolling deployments eliminate full downtime, but they introduce version coexistence. For ten to thirty minutes, both v1 and v2 process live production traffic simultaneously. If v2 requires a new database column that v1 cannot handle, v1 will crash.
  • The Golden Rule: Rolling deployments mandate the Expand-Contract (Parallel Run) database pattern: expand the schema first (adding nullable columns), deploy the application code second, and drop deprecated structures only after v1 is completely dead.

3. Blue-Green Deployment (Environment Switching)

Instead of modifying servers inside an active environment, Blue-Green deployment provisions an entirely separate, identical cluster for the new release.

flowchart TD H["Incoming HTTPS"] --> LB["Edge Load Balancer"] LB -->|"Active 100%"| B["Blue (V1)"] LB -.->|"Staged 0%"| G["Green (V2)"]
  1. Blue is live in production handling 100% of customer traffic.
  2. The team deploys version 2 into Green, running synthetic integration tests against production-like databases.
  3. Once validated, the edge router updates its target group, shifting 100% of ingress traffic to Green in milliseconds.
  4. If Green produces errors, the router flips back to Blue immediately.
  • The Trade-Off: Blue-Green offers fast cutover and instantaneous rollback. However, running two full clusters doubles infrastructure costs. Furthermore, database mutations written while Green was active cannot be automatically reversed simply by switching the router back.

4. Canary Deployment (Incremental Traffic Shifting)

Canary deployments expose a small, controlled percentage of real production traffic to the new release while keeping the vast majority of users on the stable baseline.

flowchart TD H["Incoming HTTPS"] --> TS["Traffic Splitter"] TS -->|"95% Traffic"| V1["Stable V1"] TS -->|"5% Canary"| V2["Canary V2"]

The engineering team continuously monitors telemetry: are p99 latencies increasing? Are HTTP 5xx error rates spiking? If metrics remain healthy over thirty minutes, traffic shifts from 5% to 25%, 50%, and finally 100%. If an anomaly occurs, traffic drops back to 0%.

  • The Critical Warning: 5% of traffic does not mean 5% of risk. If the canary code contains a deadlock bug in a shared PostgreSQL table, a corrupted Redis cache key, or a faulty payment API call, that 5% slice can cascade into an outage for the entire system.

5. Shadow Deployment (Traffic Mirroring)

Shadow deployments (also called Dark Launching) test new code against full real-world traffic volume without allowing the new code to affect users.

flowchart TD R["Incoming Request"] --> P["Ingress / Envoy Proxy"] P -->|"Live Path"| V1["V1 Engine"] P -.->|"Async Shadow Fork"| V2["V2 Shadow"] V1 --> U["Return to User"] V2 -.-> D["Capture & Discard"]

The edge proxy duplicates incoming HTTP requests. The original request goes to v1, and its response is returned to the user. A cloned copy of the request goes asynchronously to v2. The response from v2 is collected for observability, diffing, and latency comparisons, but is never returned to the customer.

  • The Strict Constraint: You must strictly isolate side-effects. If the service under test initiates payment authorizations, publishes queue events, or sends emails, shadow workers must use mock sinks. Replaying live traffic against stateful endpoints will result in double charging customers.

6. A/B Testing (Statistical Experimentation)

While Canary deployments test system stability, A/B testing is fundamentally about measuring user behavior and business conversion.

flowchart TD U["Eligible Users"] --> ER["Experiment Router"] ER -->|"Cohort A: 50%"| C["Control (Old UI)"] ER -->|"Cohort B: 50%"| V["Variant (New UI)"] C --> M["Measure Conversion & Cart Value"] V --> M

Eligible users are assigned to variants deterministically using consistent user hashing (e.g. hash(user_id) % 100). Both versions run simultaneously for days or weeks. Engineers and data scientists track whether the new experience drives a statistically significant lift in key business metrics (such as checkout completion, conversion rate, or average order value) while ruling out seasonal variance.

Production SRE Observability Checklist

Regardless of which deployment strategy your team selects, automated rollback gates must watch these production signals in your observability platform:

Telemetry Metric Measurement Scope Healthy Threshold Automated Rollback Trigger
http.response.5xx_rate Global Ingress Rate < 0.05% of total calls > 0.5% over 2 consecutive minutes
http.latency.p99 Downstream Services 150ms – 250ms > 2x baseline (indicates lock contention)
os.process.cpu_usage Per Container/Pod 40% – 65% > 85% (memory leaks or thread starvation)
db.connection.pool_active Database Driver < 70% capacity > 90% (unreleased connection leaks)
business.order_completed Conversion Funnel Expected baseline > 10% drop relative to control cohort

The Verdict: Selecting Your Strategy

There is no single deployment pattern that is universally superior. The right strategy directly reflects your application's architecture, database constraints, and cost tolerance:

  1. Use Recreate when services are stateless or when maintenance windows make downtime cost-free.
  2. Use Rolling when you need continuous uptime and your database migrations are strictly non-breaking.
  3. Use Blue-Green when you have budget for redundant infrastructure and require instantaneous, deterministic rollbacks.
  4. Use Canary for high-volume consumer microservices where issues must be detected under fractional production load.
  5. Use Shadow when verifying heavy algorithmic refactors or database queries without risking customer SLAs.
  6. Use A/B Testing when technical stability is established, but the business value of a feature is unproven.

In distributed systems, deployment is not just a deployment pipeline step; it is the fundamental mechanism that controls how software change interacts with human users.

Follow me at LinkedIn:

https://www.linkedin.com/in/subashpalvel/

Follow me at Medium:

https://subashpalvel.medium.com/