Configuring Spring Boot to Behave Well in High-Load in Kubernetes Live Probes Configuring Spring Boot to Behave Well in High-Load in Kubernetes Live Probes kubernetes kubernetes

Configuring Spring Boot to Behave Well in High-Load in Kubernetes Live Probes


Note: This is the answer provided by @AndyWilkinson and @ChinHuang on comments which @AlexandreCassagne stated that solved the issue:

If a liveness probe indicates that the current level of traffic is overwhelming your app such that it cannot handle requests, trying to find a way to suppress that seems counter-productive to me. Do you have a readiness probe configured? When your app becomes overwhelmed, you probably want it to indicate that it is unable to handle traffic for a while. Once the load has dropped and it's recovered, it can then start handling traffic again without the need for a restart.

Also, a liveness probe should only care about a missing resource (database, Kafka, etc) if that resource is only used by a single instance. If multiple instances all access the resource and it goes down, all of the liveness probes will fail. This will cause cascading failures and restarts across your deployment. There's some guidance on this in the Spring Boot 2.3 reference documentation.

Spring Boot 2.3 introduces separate liveness and readiness probes.