Skip to content

Merge remote-tracking branch 'upstream/main' into eds_hash

9d302b6
Select commit
Loading
Failed to load commit list.
Open

upstream: cache metadata hash for O(1) comparison in EDS updates #43351

Merge remote-tracking branch 'upstream/main' into eds_hash
9d302b6
Select commit
Loading
Failed to load commit list.
CI (Envoy) / Mobile/Coverage skipped Feb 14, 2026 in 0s

Check was skipped

This check was not triggered in this CI run

Details

Request (pr/43351/main@9d302b6)

wdauchy @wdauchy 9d302b6 #43351 merge main@af4e593

upstream: cache metadata hash for O(1) comparison in EDS updates

Commit Message:
Cache metadata hash on HostDescription to avoid expensive per-host comparisons during EDS updates. The hash is computed once when metadata is set (at host creation or update) and stored alongside the metadata. The comparison in updateDynamicHostList becomes a simple integer comparison instead of MessageDifferencer::Equivalent.

Additional Description:

For large clusters (~5-7k endpoints), updateDynamicHostList is a hot path where metadata comparison runs per host on each EDS update. Caching the hash eliminates the repeated serialization/comparison cost.

Benchmark results (5000 hosts, aarch64, -c opt):

Benchmark                                   Time             CPU   Iterations
bmUpdateHostListEquivalent/5000/5        4.39 ms         4.39 ms          159
bmUpdateHostListEquivalent/5000/20       14.1 ms         14.1 ms           50
bmUpdateHostListHash/5000/5              4.07 ms         4.07 ms          139
bmUpdateHostListHash/5000/20             12.6 ms         12.6 ms           49
bmUpdateHostListCachedHash/5000/5       0.001 ms        0.001 ms       553800
bmUpdateHostListCachedHash/5000/20      0.001 ms        0.001 ms       556835
  • Equivalent: baseline (reflection-based proto comparison)
  • Hash: recomputing hash each time (~8% faster)
  • CachedHash: pre-computed hash comparison (~4000x faster)

Risk Level: Low
Testing: Benchmark added (test/common/upstream/metadata_comparison_benchmark.cc)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Environment

Request variables

Key Value
ref 52bdfcb
sha 9d302b6
pr 43351
base-sha af4e593
actor wdauchy @wdauchy
message upstream: cache metadata hash for O(1) comparison in EDS updates...
started 1771081447.654611
target-branch main
trusted false
Build image

Container image/s (as used in this CI run)

Key Value
default docker.io/envoyproxy/envoy-build:86873047235e9b8232df989a5999b9bebf9db69c
mobile docker.io/envoyproxy/envoy-build:mobile-86873047235e9b8232df989a5999b9bebf9db69c
Version

Envoy version (as used in this CI run)

Key Value
major 1
minor 38
patch 0
dev true