Scrivio Interview library
LeadershipAdvanced6 min read · updated 12 November 2026

Your error budget reports show that every deployment across 100 services causes a short spike of 5xx errors. How would you eliminate this across teams?

I would first find the cause per service type, because the same spike can come from missing graceful shutdown, no preStop delay, readiness not failing during shutdown, or clients that do not retry idempotent requests. Then the platform sets defaults for all services: server.shutdown=graceful, a preStop sleep, a matching terminationGracePeriodSeconds and sensible readiness probes, and we make sure load balancers and the service mesh drain connections and honour readiness. Finally, a deployment check measures errors during each rollout and fails the pipeline when they appear, and deployment-caused errors are reported per service until they reach zero.

Why this question is asked

A short burst of 5xx errors on every deployment looks harmless on one service, but with 100 services deploying several times a day, it becomes a steady drain on the error budget and on customer trust. It also makes teams afraid to deploy, which slows everything down. Interviewers ask this to see whether we can diagnose a fleet-wide pattern, fix it at the platform level, and make sure it stays fixed. In this answer, we will find the causes, set platform defaults, check the traffic layer, add a deployment check, and track the results.

1Find the Cause Per Service Type

The spike is a symptom with several possible causes, and different kinds of services may have different ones. So the first step is to look at the errors themselves: which status codes, which component returned them, and at what moment of the rollout. Errors returned by the ingress or the mesh, such as 502 or 503 with no response from the application, point at traffic reaching a pod that is gone or not yet ready. Errors returned by the application itself, such as 500 with a connection pool closed message, point at the shutdown order inside the service.

I would pick a few representative services of each type, web APIs, gRPC services and services behind external load balancers, deploy them in staging under steady load, and record exactly when each error occurs relative to the pod lifecycle.

Common causes of deployment errors
CauseWhat we seeFix
No graceful shutdownin-flight requests cut, 502server.shutdown=graceful
No preStop delayconnection refused just after SIGTERMpreStop sleep 5 to 10 s
Grace period too shortSIGKILL during draingrace > preStop + shutdown timeout
Readiness passes before warm-uperrors and slow responses from new podsreadiness after runners and warm-up
Readiness ignored on shutdownexternal LB keeps sending traffichealth-checked LB, readiness drops
Clients do not retrysingle transient failure becomes 5xxretry idempotent requests once
Each cause leaves a different signature in the error logs.

2Set Platform Defaults

Most of these causes have one correct setting that every service should have, so the platform should provide it rather than asking 100 teams to remember. The shared Spring Boot starter sets server.shutdown=graceful, which is already the default from Spring Boot 3.4, and a spring.lifecycle.timeout-per-shutdown-phase of 20 seconds. The shared deployment template adds a preStop sleep of about 10 seconds, sets terminationGracePeriodSeconds to 45 so it covers the sleep plus the drain, and configures startup, liveness and readiness probes on the Actuator health groups.

Readiness must also be correct at both ends of the pod's life. At startup, the pod should only report ready after it can actually serve: after runners and cache warm-up, so new pods are not sent traffic while they are still cold. At shutdown, Spring Boot sets readiness to REFUSING_TRAFFIC, which matters for load balancers that route by health checks.

YAML
# Platform starter defaults (application.yaml)
server.shutdown: graceful
spring.lifecycle.timeout-per-shutdown-phase: 20s
management.endpoint.health.probes.enabled: true
# Platform deployment template
terminationGracePeriodSeconds: 45
lifecycle:
preStop:
sleep: { seconds: 10 } # or an exec sleep on older clusters
readinessProbe:
httpGet: { path: /actuator/health/readiness, port: 8080 }
periodSeconds: 5
failureThreshold: 2

3Make the Traffic Layer Drain Too

The application can only drain connections that reach it. Load balancers, ingress controllers and service meshes must also stop sending new requests to a terminating pod and let existing connections finish. Each has its own settings: external load balancers may need connection draining or deregistration delay to be at least as long as the preStop sleep, an ingress controller must watch endpoints rather than cache them, and a mesh sidecar such as Envoy must not exit before the application has finished, otherwise the application's responses have nowhere to go. Mesh products have specific drain settings, so check your version.

Keep-alive connections deserve attention. A client with a pooled HTTP connection to the old pod may keep using it after endpoints change. Graceful shutdown closes idle connections and signals clients, for example with Connection: close on HTTP/1.1 or GOAWAY on HTTP/2, so they reconnect elsewhere.

Finally, clients should retry idempotent requests once on a connection error or a 503, with a short backoff. That turns the occasional unavoidable transient failure into a slightly slower success.

4Fail the Pipeline When a Rollout Causes Errors

Defaults only help if we notice when a service breaks them. So the deployment pipeline gets a check: during and right after each rollout, it queries the metrics for 5xx responses of that service, from the ingress and the mesh as well as the application, and compares them with the rate just before. If the error rate rose during the rollout, the pipeline marks the deployment as failed and, for progressive rollouts, stops or rolls back.

Step throughRollout error check in the pipeline
  1. Record baseline 5xx rate5 minutes before rollout
  2. Roll out new versionpods replaced one by one
  3. Measure 5xx during rolloutingress, mesh and application metrics
  4. Errors above baseline?
    YesFail pipeline, pause or roll backNoMark deployment clean
  5. Record result per servicefeeds the weekly report

5 steps in order. Play them, or step through them one at a time.

Tools such as Argo Rollouts or Flagger can run this analysis automatically, but a simple query step in the pipeline works too. The important part is that the check uses the same signal customers feel: errors seen at the edge, not only in application logs.

5Report Until It Reaches Zero

Finally, I would publish a weekly report of deployment-caused errors per service: the number of rollouts, how many were clean, and the errors attributed to deployments. Teams with errors get the cause from the pipeline check and the platform's help to fix it. The goal is explicit and measurable: zero 5xx caused by deployments across all 100 services. Once reached, the pipeline check keeps it there, and new services start from the platform defaults.

6Follow-up questions

Why not just retry everything on the client side?

Retries hide the symptom and only work for idempotent requests. A POST that creates an order cannot be blindly retried without an idempotency key. Fixing the shutdown sequence removes the errors for every request type, and retries remain a safety net for the rare unavoidable failure.

What if a service's requests are longer than the grace period?

Then the service needs longer grace and shutdown timeouts, set through a documented override, or the long work should move to an asynchronous job that clients poll. Very long requests are also a risk during node failures, so making them resumable is better in any case.

How do you get 100 teams to adopt the defaults?

Most adopt them automatically by upgrading the platform starter and template version, which we can do with automated pull requests. The pipeline check then shows who is still affected, and the weekly report makes progress visible without anyone having to chase teams by hand.

7Conclusion

In this answer, we saw how to eliminate 5xx spikes during deployments across 100 services. We found the cause for each service type, set platform defaults for graceful shutdown, a preStop sleep, a matching grace period and correct readiness, made load balancers and the mesh drain connections and honour readiness, added a pipeline check that fails a rollout when errors appear, and reported deployment-caused errors per service until they reached zero.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by finding out where the errors come from, per type of service, because there are several causes with different signatures. Errors from the ingress or mesh with no application response usually mean traffic reached a pod that had already stopped accepting, or a new pod that was not really ready.

Then, if they want more

Errors from the application often mean in-flight requests were cut. I would reproduce it in staging under load and line up errors with the pod lifecycle. Then I would fix it once, in the platform. The Spring Boot starter sets server.shutdown graceful, which is default since 3.4, with a shutdown phase timeout of about 20 seconds.

The deployment template adds a preStop sleep of around 10 seconds so endpoint removal propagates before SIGTERM, a grace period of 45 seconds that covers both, and readiness that only passes after warm-up. I would check the traffic layer too: load balancer deregistration delays, the ingress watching endpoints, and the mesh sidecar draining and not exiting before the app.

Clients should retry idempotent requests once. To keep it fixed, the pipeline compares 5xx rates during each rollout with the baseline and fails or rolls back when they rise. And I would report deployment-caused errors per service every week until every service is at zero.

About this answer

Last updated
12 November 2026
Versions it names
Spring Boot 3.4
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Kubernetes documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your error budget reports show that every deployment across 100 services causes a short...": https://scrivio-interview-library.netlify.app/spring-boot/containers-and-kubernetes/d503b44528/