Companion code for "Deploying Spring Boot 4 on Kubernetes: Probes, Graceful Shutdown, Limits and JVM Ergonomics". A dependency outage under three probe-group setups, a rolling restart under load four ways (three runs each), the JVM's ergonomic choices for nine pod shapes, one GC-heavy load under five CPU limits with throttling counters, and an HPA driven by a Micrometer gauge through prometheus-adapter. Measured on k3s v1.36.4. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
21 lines
698 B
YAML
21 lines
698 B
YAML
# Scale orders on in-flight requests per pod, not CPU. Target: 5 in flight on average.
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata: {name: orders, namespace: demo}
|
|
spec:
|
|
scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: orders}
|
|
minReplicas: 1
|
|
maxReplicas: 4
|
|
metrics:
|
|
- type: Pods
|
|
pods:
|
|
metric: {name: app_inflight_requests}
|
|
target: {type: AverageValue, averageValue: "5"}
|
|
behavior:
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 0
|
|
scaleDown:
|
|
# The default is 300 s. Shortened so the demo shows a scale-down inside a few minutes;
|
|
# keep the default (or longer) in production.
|
|
stabilizationWindowSeconds: 30
|