When `/actuator/health` is wired to both `livenessProbe` and `readinessProbe` (`timeoutSeconds, never put downstream DB/Redis checks in livenessProbe, isolate management endpoints on a separate thread pool/port, and use startupProbe for slow JVM cold starts.
TL;DR30-second simplified summary▾
Core Mechanics: When /actuator/health is wired to both livenessProbe and readinessProbe (timeoutSeconds: 1, periodSeconds: 5, failureThreshold: 3) on 24 Spring Boot pods (200 Tomcat threads, 20 HikariCP DB connections), a brief.
Visual & Structural Flow: Depicts 4s Postgres Lock: Coupled Liveness Death Spiral vs. Isolated /readyz (Kubelet -> Mgmt Port :8081 -> Tomcat :8080 -> Postgres); Startup (75s budget) -> Live & Ready <-> NotReady (DB Stall) (STARTING -> READY -> NOT_READY -> RESTART).
Trade-Offs & Production: Simply bumping timeoutSeconds from 1 s to 5 s on /actuator/health leaves the core flaw intact: Shared Thread Pool: If all 200 Tomcat threads are blocked on Postgres. Proper startupProbe / livenessProbe / readinessProbe separation is mandatory for resilient K8s workloads: JVM & Python ML Services: Preventing CrashLoopBackOff during 30–90 s model or Spring context loading.
Failure Modes & Application: Proper startupProbe / livenessProbe / readinessProbe separation is mandatory for resilient K8s workloads: JVM & Python ML Services: Preventing CrashLoopBackOff during 30–90 s model or Spring context loading.
Why probe separation prevents cascading Kubernetes outages.
Why this matters: The mechanism: understand how Why probe separation prevents cascading Kubernetes outages works from first principles.
Think of Why probe separation prevents cascading Kubernetes outages as the intuition layer for Designing Safe Liveness & Readiness Probes: The mechanism: understand how Why probe separation prevents cascading Kubernetes outages works from first principles.
When /actuator/health is wired to both livenessProbe and readinessProbe (timeoutSeconds: 1, periodSeconds: 5, failureThreshold: 3) on 24 Spring Boot pods (200 Tomcat threads, 20 HikariCP DB connections), a brief 4-second Postgres lock contention exhausts all 200 Tomcat threads. Because /actuator/health shares Tomcat's pool and pings Postgres, all 24 pods fail liveness at 15 s, kubelet restarts the entire fleet, and 45-second JVM cold starts turn a 4-second hiccup into a 6-minute outage.
What happens when liveness probes share business pools or check Postgres.
Why this matters: The problem: see what breaks without What happens when liveness probes share business pools or check Postgres under real concurrency or scale.
Coupling livenessProbe to downstream dependencies or Tomcat's main worker pool triggers a self-inflicted death spiral:
- False-Positive Liveness Kills: Restarting a healthy JVM because Postgres paused for 4 seconds only destroys warm JIT caches and active connections.
- Cold-Start Kill Loop: Without
startupProbe,45-secondSpring boot times exceedfailureThreshold * periodSeconds, trapping pods inCrashLoopBackOff. - CFS Throttling Starvation: Tight
1 sprobe timeouts underlimits.cpu: 2get delayed by Linux CFS pauses.
4s Postgres Lock: Coupled Liveness Death Spiral vs. Isolated /readyz
Isolating /livez on port 8081 with zero DB checks keeps pods alive while /readyz sheds traffic until Postgres recovers.
- Problem
- How to implement Designing Safe Liveness & Readiness Probes without hitting unbounded tail latency, state divergence, or operational fragility.
- Naive Solution
- Use a single unpartitioned path with unbounded retries and synchronous global coordination.
- Why It Fails
- Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
- Alternatives
- Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
- Engineering Decision
- When
/actuator/healthis wired to bothlivenessProbeandreadinessProbe(`timeoutSeconds, never put downstream DB/Redis checks in livenessProbe, isolate management endpoints on a separate thread pool/port, and use startupProbe for slow JVM cold starts. - Trade-Offs
- Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
When Designing Safe Liveness & Readiness Probes experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?
Naive solution (and why raising liveness timeouts alone isn't enough).
Why this matters: The problem: see what breaks without Naive solution under real concurrency or scale.
Simply bumping timeoutSeconds from 1 s to 5 s on /actuator/health leaves the core flaw intact:
- Shared Thread Pool: If all 200 Tomcat threads are blocked on Postgres,
/actuator/healthstill sits in the Tomcat accept queue. - Wrong Signal Semantics:
livenessProbemeans 'this process is wedged and only a restart can fix it'—a slow downstream DB is never fixed by restarting the caller.
Naive solution (and why raising liveness timeouts alone isn't enough)
Enterprise solution: Dedicated Management Port + startupProbe + Shallow /livez.
Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.
Production Kubernetes services enforce three probe rules:
- Dedicated Management Port (
8081): Run Spring Boot's management server on a separate port and tiny dedicated thread pool (management.server.port=8081) so saturated business threads on8080never block health checks. - Three-Probe Separation:
startupProbe(/livez,periodSeconds: 5,failureThreshold: 15): gives75 sfor 45s JVM + Spring boot.livenessProbe(/livez,timeoutSeconds: 3): checks only in-process liveness (zero DB/Redis/downstream calls).readinessProbe(/readyz,timeoutSeconds: 2): checks HikariCP pool health / circuit breakers to remove overloaded pods fromEndpointSlicewithout restarting them.
Startup (75s budget) -> Live & Ready <-> NotReady (DB Stall)
Downstream stalls transition pods to NOT_READY via /readyz without ever triggering a /livez container restart.
# Spring Boot application.yaml + Kubernetes PodSpec
# management.server.port: 8081
# management.endpoint.health.probes.enabled: true
# management.endpoint.health.group.liveness.include: livenessState
# management.endpoint.health.group.readiness.include: readinessState,db
startupProbe:
httpGet: { path: /actuator/health/liveness, port: 8081 }
periodSeconds: 5
failureThreshold: 15 # 75s budget for 45s JVM cold start
livenessProbe:
httpGet: { path: /actuator/health/liveness, port: 8081 }
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet: { path: /actuator/health/readiness, port: 8081 }
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 2
Where Safe Probe Design applies in Kubernetes Architectures.
Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.
Proper startupProbe / livenessProbe / readinessProbe separation is mandatory for resilient K8s workloads:
- JVM & Python ML Services: Preventing
CrashLoopBackOffduring 30–90 s model or Spring context loading. - Database-Backed Microservices: Shedding traffic via
/readyzduring Postgres failovers without losing warm connection pools. - High-Concurrency Gateways: Isolating health checks from business thread pools and CFS throttling.
Practice: Make the trade-off yourself.
Why should livenessProbe never check downstream Postgres connectivity or share the main Tomcat request thread pool?