Skip to content

eds: pass ClusterLoadAssignment by value to enable move semantics#43700

Open
wdauchy wants to merge 2 commits intoenvoyproxy:mainfrom
wdauchy:wdauchy/eds-leds-avoid-protobuf-copy
Open

eds: pass ClusterLoadAssignment by value to enable move semantics#43700
wdauchy wants to merge 2 commits intoenvoyproxy:mainfrom
wdauchy:wdauchy/eds-leds-avoid-protobuf-copy

Conversation

@wdauchy
Copy link
Contributor

@wdauchy wdauchy commented Mar 1, 2026

Commit Message:
update() took a const reference, making the std::move inside it a no-op: std::move on a const& yields a const&& which resolves to the copy constructor, so every EDS config update deep-copied the entire ClusterLoadAssignment protobuf (all endpoints, localities, addresses, metadata) into the unique_ptr.

Accept by value so callers can move their local variables in. The protobuf move constructor swaps internal pointers in O(1) regardless of message size, replacing what was a full recursive copy with two pointer swaps. This matters on the EDS hot path for large clusters where the control plane pushes frequent endpoint updates.
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #43700 was opened by wdauchy.

see: more, trace.

@wdauchy wdauchy marked this pull request as ready for review March 1, 2026 11:15
@paul-r-gall
Copy link
Contributor

Do we have any EDS benchmarks?

Copy link
Contributor

@adisuissa adisuissa 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!
Left a minor comment.
Assigning a senior-maintainer as required by review guidelines.
/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only
Copy link

@envoyproxy/senior-maintainers assignee is @botengyao

🐱

Caused by: a #43700 (review) was submitted by @adisuissa.

see: more, trace.

@wdauchy
Copy link
Contributor Author

wdauchy commented Mar 3, 2026

Do we have any EDS benchmarks?

I am not sure about that :/

@wdauchy
Copy link
Contributor Author

wdauchy commented Mar 3, 2026

/retest transients

@wdauchy
Copy link
Contributor Author

wdauchy commented Mar 3, 2026

/retest

@wdauchy
Copy link
Contributor Author

wdauchy commented Mar 3, 2026

/retest transients

wdauchy added 2 commits March 4, 2026 07:32
update() took a const reference, making the std::move inside it a
no-op: std::move on a const& yields a const&& which resolves to the
copy constructor, so every EDS config update deep-copied the entire
ClusterLoadAssignment protobuf (all endpoints, localities, addresses,
metadata) into the unique_ptr.

Accept by value so callers can move their local variables in. The
protobuf move constructor swaps internal pointers in O(1) regardless
of message size, replacing what was a full recursive copy with two
pointer swaps. This matters on the EDS hot path for large clusters
where the control plane pushes frequent endpoint updates.

Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
@wdauchy wdauchy force-pushed the wdauchy/eds-leds-avoid-protobuf-copy branch from eeb1c1a to 22c81cb Compare March 4, 2026 06:32
@wdauchy
Copy link
Contributor Author

wdauchy commented Mar 4, 2026

/retest transients

@wdauchy wdauchy requested a review from adisuissa March 4, 2026 10:55
@wdauchy
Copy link
Contributor Author

wdauchy commented Mar 4, 2026

/retest transients

Copy link
Contributor

@adisuissa adisuissa 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!

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.

4 participants