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

load balancer: Add a option to configure the table size of maglev #12870

Merged
merged 12 commits into from
Sep 3, 2020

Conversation

chadr123
Copy link
Contributor

@chadr123 chadr123 commented Aug 28, 2020

Commit Message:
Currently, the maglev hash algorithm default to table size to 65537.
It is the recommended size by a paper but it is better if the user
can set this value.

This patch introduces a new MaglevLbConfig that contains table
size of maglev.

So, now, the user can set the table size of maglev by their situation.

Signed-off-by: DongRyeol Cha [email protected]
Additional Description: None
Risk Level: Low
Testing: bazel test
Docs Changes: Add a new option that name is MaglevLbConfig.
Release Notes: Changed current.rst in this PR.

DongRyeol Cha added 3 commits August 25, 2020 12:40
Currently, the maglev hash algorithm default to table size to 65537.
It is the recommanded size by a paper but it is better if the user
can set this value.

This patch introduces a new MaglevLbConfig that contains table
size of maglev.

So, now, the user can set the table size of maglev by their situation.

Signed-off-by: DongRyeol Cha <[email protected]>
Signed-off-by: DongRyeol Cha <[email protected]>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #12870 was opened by chadr123.

see: more, trace.

@@ -63,6 +66,12 @@ TEST_F(MaglevLoadBalancerTest, NoHost) {
EXPECT_EQ(nullptr, lb_->factory()->create()->chooseHost(nullptr));
};

// Throws an exception if table size is not a prime number.
TEST_F(MaglevLoadBalancerTest, NoPrimeNumber) {
EXPECT_THROW_WITH_MESSAGE(init(8), EnvoyException,
Copy link
Contributor Author

@chadr123 chadr123 Aug 28, 2020

Choose a reason for hiding this comment

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

Even if the new config is added, the table size of Maglev algorithm is not changeable. So, no need to add new tests for that because existing tests are already testing the Maglev algorithm with many table size values.

@chadr123
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #12870 (comment) was created by @chadr123.

see: more, trace.

DongRyeol Cha added 2 commits August 28, 2020 21:06
Signed-off-by: DongRyeol Cha <[email protected]>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

/lgtm api

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks this looks pretty good to me, just a couple comments

// Specific configuration for the :ref:`Maglev<arch_overview_load_balancing_types_maglev>`
// load balancing policy.
message MaglevLbConfig {
// The table size for Maglev hashing. The larger the table size reduces (that is, the more hashes there are for each
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the implication of reducing the disruption of hashing? Would be nice to add some details here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I will add more details.

ENVOY_LOG(debug, "maglev table size: {}", table_size_);
// The table size should be prime number.
if (!Primes::isPrime(table_size_)) {
throw EnvoyException("The table size of maglev should be prime number");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should -> must

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. :) I will change it.

@chadr123
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #12870 (comment) was created by @chadr123.

see: more, trace.

DongRyeol Cha added 2 commits August 29, 2020 19:59
Signed-off-by: DongRyeol Cha <[email protected]>
@chadr123
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #12870 (comment) was created by @chadr123.

see: more, trace.

@chadr123 chadr123 requested a review from snowp August 29, 2020 15:41
@chadr123 chadr123 marked this pull request as ready for review August 29, 2020 15:42
Signed-off-by: DongRyeol Cha <[email protected]>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks this looks pretty good, just some language suggestions

message MaglevLbConfig {
// The table size for Maglev hashing. In fact, Maglev aims for ‘minimal disruption’ rather than an absolute guarantee.
// The minimal disruption means when the set of upstreams changes, a connection will likely be sent to the same
// upstream as it was before. So, The larger table size reduces disruption of hashing.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe Increasing the table size reduces the amount of disruption. instead of the So, the phrasing?

// Specific configuration for the :ref:`Maglev<arch_overview_load_balancing_types_maglev>`
// load balancing policy.
message MaglevLbConfig {
// The table size for Maglev hashing. In fact, Maglev aims for ‘minimal disruption’ rather than an absolute guarantee.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would get rid of the In fact, bit.

// load balancing policy.
message MaglevLbConfig {
// The table size for Maglev hashing. In fact, Maglev aims for ‘minimal disruption’ rather than an absolute guarantee.
// The minimal disruption means when the set of upstreams changes, a connection will likely be sent to the same
Copy link
Contributor

Choose a reason for hiding this comment

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

Minimal disruption means that when the set ...

DongRyeol Cha added 2 commits September 1, 2020 12:07
@chadr123
Copy link
Contributor Author

chadr123 commented Sep 1, 2020

Thank you for your language suggestions.
It has been update. Please check it again. :)

@chadr123 chadr123 requested a review from snowp September 1, 2020 04:11
@chadr123
Copy link
Contributor Author

chadr123 commented Sep 1, 2020

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #12870 (comment) was created by @chadr123.

see: more, trace.

snowp
snowp previously approved these changes Sep 2, 2020
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks this LGTM!

@htuch This needs another API approval

@snowp
Copy link
Contributor

snowp commented Sep 2, 2020

Sorry this seems to have a merge conflict, could you resolve?

Signed-off-by: DongRyeol Cha <[email protected]>
@chadr123
Copy link
Contributor Author

chadr123 commented Sep 3, 2020

Sorry this seems to have a merge conflict, could you resolve?

Now it is resolved. :)

@chadr123 chadr123 requested review from htuch and snowp September 3, 2020 04:51
@htuch
Copy link
Member

htuch commented Sep 3, 2020

/lgtm api

@repokitteh-read-only repokitteh-read-only bot removed the api label Sep 3, 2020
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks!

@snowp snowp merged commit 5fd73ca into envoyproxy:master Sep 3, 2020
@chadr123 chadr123 deleted the table_size_maglev branch September 3, 2020 23:15
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.

3 participants