-
Notifications
You must be signed in to change notification settings - Fork 350
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
Decouple fadeIn from loadbalancer #2634
Conversation
f9a4afc
to
9119d1b
Compare
9119d1b
to
ca7934c
Compare
30a49e3
to
d51d217
Compare
98320fb
to
49d40d0
Compare
49d40d0
to
66ae555
Compare
66ae555
to
ffc324b
Compare
ffc324b
to
43f1b29
Compare
@@ -0,0 +1,279 @@ | |||
package proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those test were moved from loadbalancer/fadein_test.go
43f1b29
to
9666fc9
Compare
lgtm |
👍 |
9666fc9
to
70f1e8e
Compare
70f1e8e
to
7ce824e
Compare
e0db556
to
bf2e702
Compare
b975b7d
to
578d4ee
Compare
👍 |
loadbalancer/algorithm.go
Outdated
averageLoad := computeLoadAverage(ctx) | ||
targetLoad := averageLoad * balanceFactor | ||
// Loop round ring, starting at endpoint with closest hash. Stop when we find one whose load is less than targetLoad. | ||
for i := 0; i < ch.Len(); i++ { | ||
endpointIndex := ch.hashRing[ringIndex].index | ||
if skipEndpoint(endpointIndex) { | ||
if ctx.SkipEndpoint(endpointIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: skipFadingEndpoints did linear search over notFadingIndexes and this would do linear search over LBContext.LBEndpoints (potentially having fading endpoints filtered out) so it should not be worse performance-wise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried having an LBEndpointsSet together with LBEndpoint slice and using it in SkipEndpoint
, however, this using does not improve performance at all:
goos: linux
goarch: amd64
pkg: github.com/zalando/skipper/proxy
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
│ decoupleFadeIn.txt │ decoupleFadeInWithSet.txt │
│ sec/op │ sec/op vs base │
FadeIn/power-of-n-random-choices,_11,_1_clients-16 35.40µ ± 2% 72.97µ ± 1% +106.16% (p=0.000 n=15)
FadeIn/power-of-n-random-choices,_11,_4_clients-16 14.01µ ± 5% 28.01µ ± 9% +100.02% (p=0.000 n=15)
FadeIn/power-of-n-random-choices,_11,_16_clients-16 4.744µ ± 4% 16.192µ ± 2% +241.32% (p=0.000 n=15)
FadeIn/power-of-n-random-choices,_11,_64_clients-16 4.474µ ± 3% 12.780µ ± 1% +185.65% (p=0.000 n=15)
FadeIn/power-of-n-random-choices,_11,_256_clients-16 4.003µ ± 2% 9.654µ ± 2% +141.17% (p=0.000 n=15)
FadeIn/random,_11,_1_clients-16 36.58µ ± 2% 77.11µ ± 1% +110.79% (p=0.000 n=15)
FadeIn/random,_11,_4_clients-16 13.73µ ± 3% 26.47µ ± 13% +92.83% (p=0.000 n=15)
FadeIn/random,_11,_16_clients-16 4.680µ ± 7% 16.234µ ± 1% +246.88% (p=0.000 n=15)
FadeIn/random,_11,_64_clients-16 4.617µ ± 2% 13.017µ ± 3% +181.94% (p=0.000 n=15)
FadeIn/random,_11,_256_clients-16 4.032µ ± 2% 10.251µ ± 5% +154.24% (p=0.000 n=15)
FadeIn/round-robin,_11,_1_clients-16 36.45µ ± 2% 76.75µ ± 1% +110.56% (p=0.000 n=15)
FadeIn/round-robin,_11,_4_clients-16 12.58µ ± 4% 27.09µ ± 4% +115.37% (p=0.000 n=15)
FadeIn/round-robin,_11,_16_clients-16 4.714µ ± 5% 17.271µ ± 3% +266.38% (p=0.000 n=15)
FadeIn/round-robin,_11,_64_clients-16 4.583µ ± 3% 14.322µ ± 5% +212.50% (p=0.000 n=15)
FadeIn/round-robin,_11,_256_clients-16 4.175µ ± 2% 10.887µ ± 9% +160.77% (p=0.000 n=15)
FadeIn/consistent-hash,_11,_1_clients-16 36.05µ ± 2% 81.63µ ± 3% +126.43% (p=0.000 n=15)
FadeIn/consistent-hash,_11,_4_clients-16 12.47µ ± 7% 30.50µ ± 10% +144.55% (p=0.000 n=15)
FadeIn/consistent-hash,_11,_16_clients-16 4.402µ ± 2% 16.419µ ± 4% +272.99% (p=0.000 n=15)
FadeIn/consistent-hash,_11,_64_clients-16 4.300µ ± 2% 13.765µ ± 1% +220.12% (p=0.000 n=15)
FadeIn/consistent-hash,_11,_256_clients-16 3.974µ ± 1% 11.031µ ± 4% +177.58% (p=0.000 n=15)
geomean 8.328µ 21.87µ +162.62%
578d4ee
to
51c2401
Compare
Signed-off-by: Roman Zavodskikh <[email protected]>
51c2401
to
1112783
Compare
"github.com/zalando/skipper/routing" | ||
) | ||
|
||
func returnFast(rt *routing.Route) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name sounds a bit weird.
Maybe: noFadeIn
or shouldFadeIn
or drop the func and change the logic below ( filterFadeIn
) to:
if rt.BackendType != eskip.LBBackend || rt.LBFadeInDuration <= 0 { return endpoints }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check backend type at all? This code is only called for loadbalanced backends anyway as it passes endpoints
👍 |
1 similar comment
👍 |
All comments that are left are about code refactoring, feature-wise everything seems good. |
Loadtested v0.19.32, loadtests are okay. |
Decouple fadeIn from loadbalancer