Use GCP Monitoring Metrics for Kubernetes Autoscaling with KEDA

2 min read Original article ↗

During the 1st two intervals, the success ratio remained constant with 1 replica. As the error rate increased KEDA started scaling applications, whose resultant action can be seen by improved success ratio.

❯ bash load.sh

Requests [total, rate, throughput] 100, 100.90, 32.60

Duration [total, attack, wait] 1.533873128s, 991.125504ms, 542.747624ms

Latencies [mean, 50, 95, 99, max] 531.583998ms, 522.998243ms, 1.135576209s, 1.210611327s, 1.221199078s

Bytes In [total, mean] 3994, 39.94

Bytes Out [total, mean] 0, 0.00

Success [ratio] 50.00%

Status Codes [code:count] 200:50 500:50

Error Set:

500 Internal Server Error

Attack for completed, iteration 1/20.

Requests [total, rate, throughput] 100, 101.01, 25.31

Duration [total, attack, wait] 2.015022284s, 990.024693ms, 1.024997591s

Latencies [mean, 50, 95, 99, max] 540.398507ms, 1.008526156s, 1.105414786s, 1.230161211s, 1.235069481s

Bytes In [total, mean] 4039, 40.39

Bytes Out [total, mean] 0, 0.00

Success [ratio] 51.00%

Status Codes [code:count] 200:51 500:49

Error Set:

500 Internal Server Error

Attack for completed, iteration 2/20.

Requests [total, rate, throughput] 100, 101.04, 48.62

Duration [total, attack, wait] 2.056655297s, 989.735319ms, 1.066919978s

Latencies [mean, 50, 95, 99, max] 1.071611898s, 1.046408091s, 1.250479s, 1.28644823s, 1.296641423s

Bytes In [total, mean] 5987, 59.87

Bytes Out [total, mean] 0, 0.00

Success [ratio] 70.00%

Status Codes [code:count] 200:70 500:30

Error Set:

Attack for completed, iteration 3/20.

Requests [total, rate, throughput] 100, 101.04, 45.69

Duration [total, attack, wait] 2.166582685s, 989.747123ms, 1.176835562s

Latencies [mean, 50, 95, 99, max] 1.060029281s, 1.037487826s, 1.211447016s, 1.250660058s, 1.26766328s

Bytes In [total, mean] 5948, 59.48

Bytes Out [total, mean] 0, 0.00

Success [ratio] 80.00%

Status Codes [code:count] 200:80 500:20

Error Set:

500 Internal Server Error

Attack for completed, iteration 4/20.

Requests [total, rate, throughput] 100, 100.93, 45.01

Duration [total, attack, wait] 1.999666891s, 990.817295ms, 1.008849596s

Latencies [mean, 50, 95, 99, max] 932.347941ms, 1.01728488s, 1.096900389s, 1.135570811s, 1.139875131s

Bytes In [total, mean] 5594, 55.94

Bytes Out [total, mean] 0, 0.00

Success [ratio] 98.00%

Status Codes [code:count] 200:98 500:2

Error Set:

500 Internal Server Error

Attack for completed, iteration 6/20.

Requests [total, rate, throughput] 100, 100.99, 47.66

Duration [total, attack, wait] 1.951267076s, 990.148768ms, 961.118308ms

Latencies [mean, 50, 95, 99, max] 953.814755ms, 1.016928642s, 1.059658518s, 1.075381866s, 1.084935868s

Bytes In [total, mean] 5712, 57.12

Bytes Out [total, mean] 0, 0.00

Success [ratio] 93.00%

Status Codes [code:count] 200:93 500:7

Error Set:

500 Internal Server Error

Attack for completed, iteration 8/20.

Requests [total, rate, throughput] 100, 101.00, 48.90

Duration [total, attack, wait] 2.044873866s, 990.054865ms, 1.054819001s

Latencies [mean, 50, 95, 99, max] 1.044694019s, 1.025950457s, 1.091682248s, 1.529444546s, 1.935019526s

Bytes In [total, mean] 5987, 59.87

Bytes Out [total, mean] 0, 0.00

Success [ratio] 100.00%

Status Codes [code:count] 200:100

Error Set:

Attack for completed, iteration 10/20.

...

Load test completed.