Skip to content

server: reduce alpha for our moving averages#188

Merged
praiskup merged 1 commit into
praiskup:mainfrom
FrostyX:reduce-alpha
Jul 16, 2026
Merged

server: reduce alpha for our moving averages#188
praiskup merged 1 commit into
praiskup:mainfrom
FrostyX:reduce-alpha

Conversation

@FrostyX

@FrostyX FrostyX commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

The 0.5 favors new values too strongly, making our Zabbix graphs too spiky.

The easiest example is on the success rate. Let's assume our current
EMA (Exponential Moving Average) is 100%, and then we get one failure. This is
how different alphas affect the EMA value.

EMA = 100%, Next Value = 0%
alpha = 0.1 -> 90%
alpha = 0.2 -> 80%
alpha = 0.3 -> 70%
alpha = 0.5 -> 50%
alpha = 0.8 -> 20%

That means that one failure immediately sends us under the warning
threshold (which is currently 60%). With alpha 0.2 it would take us 3 subsequent
failures and with 0.1 it would require 5 subsequent failures.

The situation is a bit more complicated with our startup times but assuming a
starting EMA is 60s and then we have one startup that takes 250s. The alphas
affect it this way:

Starting EMA: 60s, Next Value: 250s

alpha = 0.1 -> 79s
alpha = 0.2 -> 98s
alpha = 0.3 -> 117s
alpha = 0.5 -> 155s
alpha = 0.8 -> 212s

So with alpha 0.2 it would take 6 consecutive slow attempts to hit our warning
threshold (currently 200s) and with alpha 0.1 it would take 13 attempts.

I think both alpha 0.2 or 0.1 are fine for us but 0.5 too much.

But we may need different alphas for different stats. Because for the success
rate even lower than 0.1 would be fine, while for the startup times the alpha
can be much higher since we are only counting successful starts.

The 0.5 favors new values too strongly, making our Zabbix graphs too spiky.

The easiest example is on the success rate. Let's assume our current
EMA (Exponential Moving Average) is 100%, and then we get one failure. This is
how different alphas affect the EMA value.

    EMA = 100%, Next Value = 0%
    alpha = 0.1 -> 90%
    alpha = 0.2 -> 80%
    alpha = 0.3 -> 70%
    alpha = 0.5 -> 50%
    alpha = 0.8 -> 20%

That means that one failure immediately sends us under the warning
threshold (which is currently 60%). With alpha 0.2 it would take us 3 subsequent
failures and with 0.1 it would require 5 subsequent failures.

The situation is a bit more complicated with our startup times but assuming a
starting EMA is 60s and then we have one startup that takes 250s. The alphas
affect it this way:

Starting EMA: 60s, Next Value: 250s

    alpha = 0.1 -> 79s
    alpha = 0.2 -> 98s
    alpha = 0.3 -> 117s
    alpha = 0.5 -> 155s
    alpha = 0.8 -> 212s

So with alpha 0.2 it would take 6 consecutive slow attempts to hit our warning
threshold (currently 200s) and with alpha 0.1 it would take 13 attempts.

I think both alpha 0.2 or 0.1 are fine for us but 0.5 too much.

But we may need different alphas for different stats. Because for the success
rate even lower than 0.1 would be fine, while for the startup times the alpha
can be much higher since we are only counting successful starts.
@praiskup
praiskup merged commit 64c651b into praiskup:main Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants