Rolling restart

On this page 7

A rolling restart is an operational procedure that restarts the instances of a service one at a time or in small batches, waiting for each batch to become healthy before moving on, so that the service as a whole stays available throughout. In the Services & processes area of Servers, it is the standard way to apply configuration changes, patches, certificate renewals or new releases across a cluster or pool of workers without a maintenance window.

The technique depends on redundant capacity: while some instances are down, the remaining ones must carry the full load. It is closely related to a graceful restart, which refreshes a single process without dropping connections, but a rolling restart operates at the level of a whole fleet of nodes, containers or worker processes.

How a rolling restart proceeds

A rolling restart follows a repeating drain, restart and verify cycle for each batch of instances. The orchestrator, script or process supervisor first removes the target instances from traffic, then stops and starts them, and only proceeds when a health check confirms readiness.

The steps below show one iteration of the cycle; the loop repeats until every instance has been refreshed or until a failure halts the rollout.

StepActionPurpose
Select batchPick one or more instances by order or zoneLimit the capacity removed at once
DrainDeregister from the load balancer or service registryStop new requests reaching the instance
Wait for in-flight workAllow open requests and jobs to finish within a timeoutAvoid failed or duplicated work
RestartSend a stop signal, then start the new processLoad new code, configuration or libraries
VerifyRun readiness and health probesConfirm the instance serves correctly
Re-registerReturn the instance to the poolRestore full capacity before the next batch
One iteration of a rolling restart

The drain step is what separates a rolling restart from a blind reboot loop. Without it, clients connected to a stopping instance receive errors even though the cluster as a whole remains up. The drain usually relies on graceful shutdown handling in the application, typically reacting to SIGTERM by refusing new work and finishing current requests.

Parameters that control the rollout

A rolling restart is tuned through a small set of pacing and safety parameters. Their values decide how quickly the change spreads and how much capacity is at risk at any moment.

ParameterTypical valueWhat it affects
Batch size1 instance or 10-25% of the poolSpeed versus capacity loss
Max unavailable0-1 instances, or a percentageLowest acceptable serving capacity
Max surge0-25% extra instancesTemporary overprovisioning during rollout
Drain timeout30 s to several minutesTime allowed for in-flight work
Health check grace period10-120 sStartup time before probes count
Pause between batches0 s to several minutesTime to observe error rates and latency
Common rolling restart parameters

In Kubernetes, the Deployment object exposes these as maxUnavailable and maxSurge, and kubectl rollout restart triggers a restart without changing the image. On classic hosts, the same logic is usually written into an Ansible playbook with a serial setting, a shell loop, or the reload command of a process manager such as PM2.

Rolling restart compared with other restart methods

A rolling restart is one of several ways to refresh a running service, and each method trades availability, speed and resource cost differently. The choice depends on how many instances exist and whether old and new versions can run side by side.

MethodScopeDowntimeExtra capacity needed
Full restartAll instances at onceYes, for the restart durationNone
Graceful restartOne master process and its workersNone if connections are handed overNone
Rolling restartInstances in sequential batchesNone if capacity is sufficientSpare headroom for one batch
Blue-green switchEntire parallel environmentNear zero at cutoverAbout double
Canary releaseSmall share of traffic firstNoneA few instances
Restart and replacement methods

The key distinction is that a rolling restart mixes old and new instances for a period of time. When a release changes a database schema, a message format or an API contract, both versions must be compatible during the overlap, otherwise a blue-green switch or a staged migration is safer.

When to use a rolling restart

A rolling restart fits any service that runs as multiple interchangeable instances behind a load balancer, service registry or shared queue. Typical triggers are operational rather than functional.

  • Applying operating system or library patches that require a process restart, such as an OpenSSL update.
  • Reloading configuration or secrets that the application reads only at startup.
  • Clearing memory leaks or resource exhaustion in long-running processes before they cause failures.
  • Rotating TLS certificates where the server does not support hot reload.
  • Deploying a new application version when the build is backward compatible with the running one.

Stateful systems need extra care. In database clusters, search clusters or message brokers, operators usually restart replicas before the primary, wait for replication to catch up, and disable automatic shard rebalancing during the restart so that a briefly missing node does not trigger unnecessary data movement.

Risks and common mistakes

Most rolling restart incidents come from insufficient capacity or weak health checks, not from the restart mechanism itself. The table lists frequent symptoms, their cause and the usual remedy.

SymptomLikely causeFix
Error spike during each batchNo drain, or drain timeout too shortDeregister first and honor graceful shutdown
Latency rises across the clusterRemaining instances overloadedReduce batch size or add surge capacity
Rollout completes but service failsHealth check tests only that the port is openUse a readiness probe that exercises real dependencies
Instances restart repeatedlyNew configuration crashes on startHalt the rollout and roll back automatically
Cache stampede on the backendAll restarted instances start with cold cachesWarm caches or slow the pace between batches
Frequent rolling restart problems

A further risk is the false sense of safety of a slow rollout. If a defect only appears under load or after hours of uptime, every instance may already run the faulty version before anyone notices, so the rollout should be paired with metrics-based gates and a fast rollback path.

Stripped to the essentials

A rolling restart means restarting a group of servers one after another instead of all at once. While one server is being restarted, the others keep answering users, so nobody notices an outage.

Think of a supermarket with six open checkouts that need new card readers. The manager closes one checkout, lets its last customers finish, installs the reader, reopens it, and then moves to the next one. Shoppers keep paying the whole time. The key takeaway is simple: the method only works if the remaining checkouts can handle the queue while one is closed.

Where it is applied

An online retailer runs its checkout API on eight application servers behind a load balancer. A critical vulnerability is announced in the TLS library linked into the runtime, and the patch requires every process to restart. Peak traffic needs about five servers, so the operations team can safely take two servers out at a time.

An automation playbook drains two servers from the load balancer, waits up to 60 seconds for open requests to finish, installs the patched package, restarts the service, and waits until the readiness endpoint reports healthy database and cache connections. It then pauses two minutes while the team watches error rates before continuing with the next pair.

The whole cluster is patched in about 25 minutes during business hours, with no failed checkouts and no maintenance notice to customers. When the third batch briefly showed higher latency, the pause gave the team time to confirm it was cache warm-up rather than a fault, and the rollout continued.