Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: admissionControl filter #2030

Merged
merged 2 commits into from
Jul 6, 2022
Merged

Conversation

szuecs
Copy link
Member

@szuecs szuecs commented Jun 22, 2022

load shedding filter admissionControl, part of #2004

Signed-off-by: Sandor Szücs sandor.szuecs@zalando.de

@szuecs szuecs added the wip work in progress label Jun 22, 2022
@szuecs szuecs force-pushed the feature/admission-control-filter branch 3 times, most recently from 5ab2f3a to ce6eeea Compare June 30, 2022 21:08
@szuecs szuecs added ready-for-review and removed wip work in progress labels Jun 30, 2022
@szuecs szuecs force-pushed the feature/admission-control-filter branch 3 times, most recently from 0346e82 to a13acbc Compare June 30, 2022 21:41
@szuecs szuecs changed the title initial admissionControl filter feature: admissionControl filter Jun 30, 2022
Comment on lines +185 to +188
epsilon := 0.05 * N // maybe 5% instead of 0.1%
expectedFails := (N - failBackend) * ti.pExpectedAdmissionShedding

if expectedFails-epsilon > fail || fail > expectedFails+epsilon {
t.Errorf("Failed to get expected fails should be in: %0.2f < %0.2f < %0.2f", expectedFails-epsilon, fail, expectedFails+epsilon)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment on what we check here, it is hard to follow.

For the epsilon check maybe it is better to calculate the diff first

diff := math.Abs(fails - expectedFails)
if diff > epsilon {
    t.Error(...)
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's more easy, than you suggestion and if you read it like a math equation it's simpler to follow:

A-e > fail > A+e

@szuecs szuecs force-pushed the feature/admission-control-filter branch from a61765d to 3edd5a7 Compare July 1, 2022 17:02
docs/reference/filters.md Outdated Show resolved Hide resolved
docs/reference/filters.md Outdated Show resolved Hide resolved
docs/reference/filters.md Outdated Show resolved Hide resolved
…ackend errors

    admissionControl(metricsSuffix, mode, d, windowSize, minRPS, successThreshold, maxRejectProbability, exponent)
    admissionControl("myapp", "active", "1s", 5, 10, 0.9, 0.95, 2.0)

metricSuffix is the suffix key to expose reject counter, should be unique by filter instance
mode is one of "active", "inactive", "log"
windowSize is within [minWindowSize, maxWindowSize]
minRPS
successThreshold is within (0,1] and sets the lowest request success rate at which the filter will not reject requests.
maxRejectProbability is within (0,1] and sets the upper bound of reject probability.
exponent >0, 1: linear, 1/2: qudratic, ..

see also https://opensource.zalando.com/skipper/reference/filters/#admissioncontrol

safety: handles background goroutine close on update and delete
feature: add preprocessor to remove filter duplicates, last wins

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
@szuecs szuecs force-pushed the feature/admission-control-filter branch from d704159 to 97ee825 Compare July 5, 2022 10:49
cleanup: deleting a filter will close that filter

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
}

type validationPostProcessorNumberOfFilters struct {
ch chan []*routing.Route
Copy link
Member

@AlexanderYastrebov AlexanderYastrebov Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: Maybe it could have *testing.T field and call t.Error if admission filter counter is more than one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that t is not Thread safe. At least in my tests I got warnings or a panic, don't remember anymore.

@AlexanderYastrebov
Copy link
Member

👍

1 similar comment
@szuecs
Copy link
Member Author

szuecs commented Jul 6, 2022

👍

@szuecs szuecs merged commit ce89ee3 into master Jul 6, 2022
@szuecs szuecs deleted the feature/admission-control-filter branch July 6, 2022 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants