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(*) automatically set proxy concurrency #2691

Merged
merged 2 commits into from
Sep 2, 2021
Merged

feat(*) automatically set proxy concurrency #2691

merged 2 commits into from
Sep 2, 2021

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Aug 26, 2021

Summary

This commit adds the --concurrency flag to kuma-dp, which is propagated
to Envoy's --concurrency flag. On Linux, if there is no explicit
concurrency, we pass --cpuset-threads so that Envoy will automatically
scale its worker thread if it is in a cpuset.

In Kubernetes clusters, we can add additional automatic controls for the
Envoy concurrency. We know the amount of CPU resource reserved for the
proxy container, so we can tune that automatically. If the operator knows
better, then can set an explicit concurency value with a pod annotation.

I don't expect any performance changes with this PR, since in the Kubernetes
case, the proxy container already has cgroups limits enabled. I'd be happy to
run any performance regression tests if we have them though.

Full changelog

  • Add the --concurrency flag to kum-ap for setting the number of Envoy worker threads
  • On Kubernetes, Kuma automatically tunes the Envoy worker threads to match the proxy container resource limits
  • Kuma automatically configures Envoy to adapt to cpuset limits.

Issues resolved

Fix #1721

Documentation

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

Backwards compatibility

  • Add backport-to-stable label if the code is backwards compatible. Otherwise, list breaking changes.

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2021

Codecov Report

Merging #2691 (6b96725) into master (1ec22de) will increase coverage by 0.08%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2691      +/-   ##
==========================================
+ Coverage   52.21%   52.29%   +0.08%     
==========================================
  Files         865      865              
  Lines       49299    49322      +23     
==========================================
+ Hits        25741    25794      +53     
+ Misses      21476    21440      -36     
- Partials     2082     2088       +6     
Impacted Files Coverage Δ
pkg/config/app/kuma-dp/config.go 63.15% <ø> (ø)
pkg/plugins/runtime/k8s/metadata/annotations.go 86.36% <ø> (ø)
.../plugins/runtime/k8s/webhooks/injector/injector.go 85.79% <90.00%> (+0.04%) ⬆️
app/kuma-dp/cmd/run.go 71.33% <100.00%> (+0.19%) ⬆️
app/kuma-dp/pkg/dataplane/envoy/envoy.go 80.34% <100.00%> (+1.25%) ⬆️
pkg/core/resources/manager/cache.go 81.81% <0.00%> (-2.60%) ⬇️
pkg/xds/generator/direct_access_proxy_generator.go 82.75% <0.00%> (-1.15%) ⬇️
pkg/insights/resyncer.go 67.16% <0.00%> (+1.49%) ⬆️
pkg/plugins/resources/memory/store.go 82.06% <0.00%> (+4.34%) ⬆️
pkg/xds/cache/once/cache.go 94.87% <0.00%> (+7.69%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ec22de...6b96725. Read the comment docs.

This commit adds the `--concurrency` flag to kuma-dp, which is propagated
to Envoy's `--concurrency` flag. On Linux, if there is no explicit
concurrency, we pass `--cpuset-threads` so that Envoy will automatically
scale its worker thread if it is in a cpuset.

In Kubernetes clusters, we can add additional automatic controls for the
Envoy concurrency. We know the amount of CPU resource reserved for the
proxy container, so we can tune that automatically. If the operator knows
better, then can set an explicit concurency value with a pod annotation.

This fixes #1721.

Signed-off-by: James Peach <james.peach@konghq.com>
@jpeach jpeach marked this pull request as ready for review September 1, 2021 08:20
@jpeach jpeach requested a review from a team as a code owner September 1, 2021 08:20
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz left a comment

Choose a reason for hiding this comment

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

nice!!

Signed-off-by: James Peach <james.peach@konghq.com>
@jpeach jpeach merged commit 1f0cf6e into kumahq:master Sep 2, 2021
mergify bot pushed a commit that referenced this pull request Sep 2, 2021
This commit adds the `--concurrency` flag to kuma-dp, which is propagated
to Envoy's `--concurrency` flag. On Linux, if there is no explicit
concurrency, we pass `--cpuset-threads` so that Envoy will automatically
scale its worker thread if it is in a cpuset.

In Kubernetes clusters, we can add additional automatic controls for the
Envoy concurrency. We know the amount of CPU resource reserved for the
proxy container, so we can tune that automatically. If the operator knows
better, then can set an explicit concurency value with a pod annotation.

This fixes #1721.

Signed-off-by: James Peach <james.peach@konghq.com>
(cherry picked from commit 1f0cf6e)
@jpeach jpeach deleted the feat/automatic-concurrency branch September 2, 2021 21:58
jpeach added a commit that referenced this pull request Sep 7, 2021
This commit adds the `--concurrency` flag to kuma-dp, which is propagated
to Envoy's `--concurrency` flag. On Linux, if there is no explicit
concurrency, we pass `--cpuset-threads` so that Envoy will automatically
scale its worker thread if it is in a cpuset.

In Kubernetes clusters, we can add additional automatic controls for the
Envoy concurrency. We know the amount of CPU resource reserved for the
proxy container, so we can tune that automatically. If the operator knows
better, then can set an explicit concurency value with a pod annotation.

This fixes #1721.

Signed-off-by: James Peach <james.peach@konghq.com>
(cherry picked from commit 1f0cf6e)

Co-authored-by: James Peach <james.peach@konghq.com>
nikita15p pushed a commit to nikita15p/kuma that referenced this pull request Sep 28, 2021
This commit adds the `--concurrency` flag to kuma-dp, which is propagated
to Envoy's `--concurrency` flag. On Linux, if there is no explicit
concurrency, we pass `--cpuset-threads` so that Envoy will automatically
scale its worker thread if it is in a cpuset.

In Kubernetes clusters, we can add additional automatic controls for the
Envoy concurrency. We know the amount of CPU resource reserved for the
proxy container, so we can tune that automatically. If the operator knows
better, then can set an explicit concurency value with a pod annotation.

This fixes kumahq#1721.

Signed-off-by: James Peach <james.peach@konghq.com>
nikita15p pushed a commit to nikita15p/kuma that referenced this pull request Sep 28, 2021
This commit adds the `--concurrency` flag to kuma-dp, which is propagated
to Envoy's `--concurrency` flag. On Linux, if there is no explicit
concurrency, we pass `--cpuset-threads` so that Envoy will automatically
scale its worker thread if it is in a cpuset.

In Kubernetes clusters, we can add additional automatic controls for the
Envoy concurrency. We know the amount of CPU resource reserved for the
proxy container, so we can tune that automatically. If the operator knows
better, then can set an explicit concurency value with a pod annotation.

This fixes kumahq#1721.

Signed-off-by: James Peach <james.peach@konghq.com>
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.

Add ability to pass --concurrency to envoy
3 participants