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/admission control multi layer support #2443

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

szuecs
Copy link
Member

@szuecs szuecs commented Jul 4, 2023

feature: admission control multi layer support

fix: inode admission controllers should not count shedded responses by leaf admission controllers
test: create test that check the leaf admission controllers will not interfere with inode admission controllers in the call tree
test: fix flaky test (works on my machine)

@szuecs szuecs added the wip work in progress label Jul 4, 2023
@szuecs szuecs force-pushed the feature/admission-control-multi-layer-support branch from 8183949 to 7ee6f29 Compare August 11, 2023 20:25
…y other admission controllers

test: create test that check the leaf admission controllers will not interfere with inode admission controllers in the call tree
test: fix flaky test (works on my machine)

Signed-off-by: Sandor Szücs <[email protected]>
@szuecs szuecs force-pushed the feature/admission-control-multi-layer-support branch from 7ee6f29 to d9cfbcc Compare August 11, 2023 20:28
@szuecs szuecs removed the wip work in progress label Aug 11, 2023
@szuecs
Copy link
Member Author

szuecs commented Aug 11, 2023

Also got #2435

@szuecs szuecs mentioned this pull request Aug 11, 2023

argsLeaf := make([]interface{}, 0, 6)
argsLeaf = append(argsLeaf, "testmetric-leaf", "active", "5ms", 5, 5, 0.9, 0.95, 1.0)
fLeaf, err := spec.CreateFilter(argsLeaf)
Copy link
Member

Choose a reason for hiding this comment

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

I think filter creation in this tests obscures the main test logic. Do we need it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Strictly we don't need it but creating invalid filters is easy to do with so many args, so I think it's better to bail out early.

Comment on lines +293 to +296
reqURL, err := url.Parse(proxy.URL)
if err != nil {
t.Fatalf("Failed to parse url %s: %v", proxy.URL, err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Proxy url is always valid, no need to parse it

Copy link
Member Author

@szuecs szuecs Aug 14, 2023

Choose a reason for hiding this comment

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

True, but also does not hurt either.
I am used to always check the error.

Comment on lines +298 to +299
rt := net.NewTransport(net.Options{})
defer rt.Close()
Copy link
Member

Choose a reason for hiding this comment

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

Why not proxy.Client() which is https://pkg.go.dev/net/http/httptest#Server.Client

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case I want to have a well configured connection pool. In cases which require a significant amount of requests to make sense we should rely on our configuration.

Comment on lines +129 to +136
windowsize: 5,
minRequests: 10,
successThreshold: 0.9,
maxrejectprobability: 0.95,
exponent: 1.0,
N: 20,
pBackendErr: 0.8,
pExpectedAdmissionShedding: 0.0,
Copy link
Member

Choose a reason for hiding this comment

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

I just trust these numbers make sense :)

Copy link
Member Author

@szuecs szuecs Aug 14, 2023

Choose a reason for hiding this comment

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

I basically copied the last test that has pExpectedAdmissionShedding: 0.91, and for "inactive" I expect pExpectedAdmissionShedding: 0. Same for case "logInactive".

for i := 0; i < N; i++ {
r := lim.Reserve()
for !r.OK() {
time.Sleep(10 * time.Microsecond)
Copy link
Member

Choose a reason for hiding this comment

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

This makes tests run longer. We need to think whether it is necessary and maybe we can mock the clock like in #2432 and #2453

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 need to have something that jitters the funcs, because otherwise you get errors from the runtime.

@AlexanderYastrebov
Copy link
Member

👍

1 similar comment
@szuecs
Copy link
Member Author

szuecs commented Aug 14, 2023

👍

@szuecs szuecs merged commit e0dd155 into master Aug 14, 2023
6 checks passed
@szuecs szuecs deleted the feature/admission-control-multi-layer-support branch August 14, 2023 15:51
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.

2 participants