docs icon indicating copy to clipboard operation
docs copied to clipboard

Querying the auto-scaling formula

Open clxseizetheday opened this issue 4 years ago • 4 comments

hello guys, I am reading the document about the autoscaling of OpenFaas. In the chapter 'Autoscaling', https://docs.openfaas.com/architecture/autoscaling/#how-auto-scaling-works it gives a formula about the strategy of calculating the desire replics amount.

it says desired = current replicas * (current load / (target load per replica * current replicas)) however, the first current replicas in the formula and the current replicas in the denominator will always cancel out. So how should I understand this formula?

Thanks

clxseizetheday avatar Feb 18 '22 14:02 clxseizetheday

In fact, if I cancel out the two current replicas in the formula, it will turn into desired = current load / target load per replica. This new formula is easy to understand. In my opinion, current load will not change before and after the sacling, so just divide target load per replica by current load and then you get the desired replics, right? How does current replicas influence the origin formula?

clxseizetheday avatar Feb 18 '22 15:02 clxseizetheday

@alexellis I think it might be best for you to comment here, given your recent work on scaling

LucasRoesler avatar Feb 19 '22 11:02 LucasRoesler

The formula should match that of Kubernetes HPAv2:

https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details

alexellis avatar May 26 '22 09:05 alexellis

/set title: Querying the auto-scaling formula

alexellis avatar May 26 '22 09:05 alexellis