-
Notifications
You must be signed in to change notification settings - Fork 3.4k
maglev: Cleanup implementation #35885
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
Conversation
/test |
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.
Loader changes LGTM
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.
ack for CLI changes.
31006dd
to
8d30867
Compare
8d30867
to
5b9ccd7
Compare
cb20112
to
7f7a5b5
Compare
/test |
7f7a5b5
to
1b85500
Compare
/test |
1b85500
to
58cc253
Compare
/test |
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.
Nice, thank you!
39bebc2
to
9286446
Compare
/test |
6846835
to
a6f67d1
Compare
/test |
Benchmark also the more realistic smaller sizes. Results from my machine: goos: linux goarch: amd64 pkg: github.com/cilium/cilium/pkg/maglev cpu: 13th Gen Intel(R) Core(TM) i9-13950HX BenchmarkGetMaglevTable/2039-32 681 1746071 ns/op 130665 B/op 151 allocs/op BenchmarkGetMaglevTable/4093-32 367 2793396 ns/op 212250 B/op 151 allocs/op BenchmarkGetMaglevTable/16381-32 135 8171612 ns/op 1192045 B/op 151 allocs/op BenchmarkGetMaglevTable/131071-32 22 52912588 ns/op 1138965 B/op 151 allocs/op Signed-off-by: Jussi Maki <jussi@isovalent.com>
Add a test to maglev to make sure the generated table is always the same with the default configuration. This ensures we don't accidentally change the algorithm and end up with differing maglev tables on nodes when upgrading. Signed-off-by: Jussi Maki <jussi@isovalent.com>
Parallel test cases in pkg/loadbalancer/experimental are causing racy access to the maglev permutations array. Refactor the maglev package into a cell with its own configuration to allow safely using it in parallel tests with potentially different configurations. To avoid needless copying and construction of temporary data structures, pass the backends as a sequence to GetLookupTable. Benchmark results: goos: linux goarch: amd64 pkg: github.com/cilium/cilium/pkg/maglev cpu: 13th Gen Intel(R) Core(TM) i9-13950HX BenchmarkGetMaglevTable/2039-32 724 1668577 ns/op 55210 B/op 146 allocs/op BenchmarkGetMaglevTable/4093-32 456 2624453 ns/op 112473 B/op 146 allocs/op BenchmarkGetMaglevTable/16381-32 135 8564586 ns/op 1060573 B/op 146 allocs/op BenchmarkGetMaglevTable/131071-32 25 49359121 ns/op 548535 B/op 146 allocs/op Signed-off-by: Jussi Maki <jussi@isovalent.com>
a6f67d1
to
2993089
Compare
/test |
This makes the maglev implementation a bit more generic by not depending on the
loadbalancer.Backend
type directly, but instead just taking in the bare minimum. To avoid temporary data structures the backend infos are passed as a iter.Seq. This allows #35430 to avoid the sillyness of convertingexperimental.Backend
intoloadbalancer.Backend
and having to build up temporary hash maps.To make sure the refactoring does not introduce any changes the
TestReproducible
hard-codes the expected maglev table to check against.