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

feat: configure overload manager #3082

Merged
merged 2 commits into from
Apr 5, 2024
Merged

Conversation

shahar-h
Copy link
Contributor

@shahar-h shahar-h commented Apr 2, 2024

What type of PR is this?
feature

What this PR does / why we need it:
Configure overload manager as recommended in Configuring Envoy as an edge proxy guide with the following:

  • Set global downstream connection limits to 50000.
  • Dynamically set max_heap_size_bytes to 80% of Envoy container memory limits. in case there are no limits max_heap_size_bytes is not being set. This approach has been agreed here.

Which issue(s) this PR fixes:
Fixes #1966
Related #1048

Note regarding global downstream connection limits:
latest stable Envoy(v1.29.2) docs suggests to use new overload manager API and also states: "One could also set this limit via specifying an integer through the runtime key overload.global_downstream_max_connections, though this key is deprecated and will be removed in future".
However, when navigating to Downstream connections API page it is stated that it's currently work-in-progress.

Signed-off-by: Shahar Harari <shahar.harari@sap.com>
@shahar-h shahar-h requested a review from a team as a code owner April 2, 2024 16:41
Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.59%. Comparing base (9416798) to head (3f34cf8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3082      +/-   ##
==========================================
+ Coverage   66.54%   66.59%   +0.04%     
==========================================
  Files         157      157              
  Lines       21956    21976      +20     
==========================================
+ Hits        14611    14635      +24     
+ Misses       6502     6499       -3     
+ Partials      843      842       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Shahar Harari <shahar.harari@sap.com>
@shahar-h
Copy link
Contributor Author

shahar-h commented Apr 2, 2024

/retest

3 similar comments
@guydc
Copy link
Contributor

guydc commented Apr 2, 2024

/retest

@shahar-h
Copy link
Contributor Author

shahar-h commented Apr 2, 2024

/retest

@shahar-h
Copy link
Contributor Author

shahar-h commented Apr 2, 2024

/retest

Copy link
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

// caclulateMaxHeapSizeBytes calculates the maximum heap size in bytes as 80% of Envoy container memory limits.
// In case no limits are defined '0' is returned, which means no heap size limit is set.
func caclulateMaxHeapSizeBytes(envoyResourceRequirements *corev1.ResourceRequirements) uint64 {
if envoyResourceRequirements == nil || envoyResourceRequirements.Limits == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

also lets make this method best effort
so it returns a *unit64, when we cannot compute the size lets return nil
and not add a max any FixedHeapConfig for that case

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you already handle 0, suggest changing the API signature to return a ptr instead so the caller can use nil as a way to make a decision

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0 is an illegal value for max_heap_size_bytes, so it means it's disabled. It can be returned in 2 cases:

  1. No memory limits are defined
  2. Memory limits are 0, which has the same affect as 1

I don't see a value in changing the signature to ptr unless I missed something.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I verified it by defining 0 and got validation error from Envoy at runtime.

@arkodg
Copy link
Contributor

arkodg commented Apr 5, 2024

looks good ! just added one comment around using a ptr to improve the distinction b/w unset/unknown and 0

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

@arkodg arkodg merged commit 07f8a47 into envoyproxy:main Apr 5, 2024
19 checks passed
@shahar-h shahar-h deleted the overload-manager branch April 5, 2024 16:48
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.

Global downstream connection limits.
3 participants