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.
| Step | Action | Purpose |
|---|---|---|
| Select batch | Pick one or more instances by order or zone | Limit the capacity removed at once |
| Drain | Deregister from the load balancer or service registry | Stop new requests reaching the instance |
| Wait for in-flight work | Allow open requests and jobs to finish within a timeout | Avoid failed or duplicated work |
| Restart | Send a stop signal, then start the new process | Load new code, configuration or libraries |
| Verify | Run readiness and health probes | Confirm the instance serves correctly |
| Re-register | Return the instance to the pool | Restore full capacity before the next batch |
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.
| Parameter | Typical value | What it affects |
|---|---|---|
| Batch size | 1 instance or 10-25% of the pool | Speed versus capacity loss |
| Max unavailable | 0-1 instances, or a percentage | Lowest acceptable serving capacity |
| Max surge | 0-25% extra instances | Temporary overprovisioning during rollout |
| Drain timeout | 30 s to several minutes | Time allowed for in-flight work |
| Health check grace period | 10-120 s | Startup time before probes count |
| Pause between batches | 0 s to several minutes | Time to observe error rates and latency |
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.
| Method | Scope | Downtime | Extra capacity needed |
|---|---|---|---|
| Full restart | All instances at once | Yes, for the restart duration | None |
| Graceful restart | One master process and its workers | None if connections are handed over | None |
| Rolling restart | Instances in sequential batches | None if capacity is sufficient | Spare headroom for one batch |
| Blue-green switch | Entire parallel environment | Near zero at cutover | About double |
| Canary release | Small share of traffic first | None | A few instances |
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.
| Symptom | Likely cause | Fix |
|---|---|---|
| Error spike during each batch | No drain, or drain timeout too short | Deregister first and honor graceful shutdown |
| Latency rises across the cluster | Remaining instances overloaded | Reduce batch size or add surge capacity |
| Rollout completes but service fails | Health check tests only that the port is open | Use a readiness probe that exercises real dependencies |
| Instances restart repeatedly | New configuration crashes on start | Halt the rollout and roll back automatically |
| Cache stampede on the backend | All restarted instances start with cold caches | Warm caches or slow the pace between batches |
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.