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

Improve EndpointLookupsCache occupancy #9876

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fasaxc
Copy link
Member

@fasaxc fasaxc commented Feb 20, 2025

Description

  • Avoid storing complete WorkloadEndpoint/HostEndpoint objects in the EndpointLookupCache. Extract the required fields and store only what is needed. The rest of the calculation graph already discards data it doesn't need to reduce occupancy, but a single new place that stores the "original" object results in storing both the full original object and the smaller extracted structs elsewhere.

  • Split the cache into local and remote maps.

    • We need to store more information about local endpoints so splitting the type of the cache entry avoids storing extra fields for every remote endpoint.
    • Using two maps instead of a map with interface value saves 8 bytes per map slot.
    • Using two types stores the "is local" bool in the type rather than the value, saving another 8 bytes.
  • Expose the EndpointData as an interface instead of a struct for the collector/aggregator to use.

  • Add utility methods and marker methods to the "model" datatypes, makes it a lot easier to work with WEPs and HEPs as a single type (and gives type checking in more places throughout the calc graph).

Related issues/PRs

CORE-11061

Todos

  • Tests
  • Documentation
  • Release note

Release Note

TBD

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

@marvin-tigera marvin-tigera added this to the Calico v3.30.0 milestone Feb 20, 2025
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Feb 20, 2025
@fasaxc fasaxc force-pushed the improve-elc branch 2 times, most recently from 2c4aafe to 6f57e79 Compare February 20, 2025 15:39
@fasaxc fasaxc added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Feb 20, 2025
- Introduce an interface around the endpoint data so that
  we can change the internal implementation to use more efficient
  storage.

- Introduce model.EndpointXXX types.

- Split local/remote endpoint data.
  Reduces size of map by storing only a pointer, not an interface
  for each value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants