Add keda: Spring Boot 4.2.0 Kafka consumers under KEDA autoscaling (partition cap, lag maths, rebalances, SIGTERM vs SIGKILL)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
This commit is contained in:
Claude
2026-12-02 00:07:44 +05:30
parent 5facfdc212
commit 0b31b49571
24 changed files with 1212 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
Lag is read from the broker (log end offset - committed offset, summed).
Replica counts come from KedaMath, a model of the scaler + HPA (KEDA is not run here).
A) uniform: {0=100, 1=100, 2=100, 3=100, 4=100, 5=100} total=600
lagThreshold=100 -> total=600 metric=600 desired=6
lagThreshold=50 (wants 12, 6 partitions) -> total=600 metric=300 desired=6
same, allowIdleConsumers=true -> total=600 metric=600 desired=12
B) skewed (hot key): {0=600, 1=0, 2=0, 3=0, 4=0, 5=0} total=600
default -> total=600 desired=6 (5 of 6 pods would sit idle)
limitToPartitionsWithLag=true -> total=600 desired=1
C) remainder edge: {0=150, 1=100, 2=100, 3=100, 4=100, 5=100} total=650
650 / 100 = 6 (integer) is not > 6, so the clamp is skipped -> metric=650 desired=7 on 6 partitions
D) activation (minReplicaCount=0, activationLagThreshold=0):
lag=0 -> active=false desired=0; lag=1 -> active=true desired=1