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

perf(kuma-cp): avoid rebuilding endpoint map #4974

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

jakubdyszkiewicz
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz commented Sep 7, 2022

This PR removes rebuilding endpoint map in DataplaneProxyBuilder.
We already compute endpoint map for all data plane proxy in the mesh and cache it in MeshContext.
However, we were rebuilding the map in DataplaneProxyBuilder, because if we had no zone egress we decided if we want to include external service endpoints based on traffic permission. I changed the logic to only compute external services endpoint for each data plane proxy and share the endpoint map for the rest of services.

This saves a significant amount of CPU (2-3x when benchmarking with in-memory storage and mock Envoys)

Before:
master
image

After:
perf-fix

image

Fix #2989

Checklist prior to review

  • Link to docs PR or issue -- no
  • Link to UI issue or PR -- no
  • Is the issue worked on linked? -- xDS proxy routing targets are mostly not used  #2989
  • The PR does not hardcode values that might break projects that depend on kuma (e.g. "kumahq" as a image registry) -- no
  • The PR will work for both Linux and Windows, system specific functions like syscall.Mkfifo have equivalent implementation on the other OS -- no
  • Unit Tests --
  • E2E Tests --
  • Manual Universal Tests --
  • Manual Kubernetes Tests --
  • Do you need to update UPGRADE.md? -- no
  • Does it need to be backported according to the backporting policy? -- no
  • Do you need to explicitly set a > Changelog: entry here?

Changelog perf(kuma-cp): avoid rebuilding endpoint map

@jakubdyszkiewicz jakubdyszkiewicz marked this pull request as ready for review September 7, 2022 09:17
@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team as a code owner September 7, 2022 09:17
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

That's a great perf improvement and also a nice code readability improvement :)

@jakubdyszkiewicz jakubdyszkiewicz merged commit 7432f15 into kumahq:master Sep 7, 2022
@jakubdyszkiewicz jakubdyszkiewicz deleted the perf/endpoint-map branch September 7, 2022 10:00
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.

xDS proxy routing targets are mostly not used
2 participants