Skip to content

test/load_aware_locality: Optimize with simtime and connection reuse - #49074

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
phlax:load-aware-locality-test-sim-time
Nov 13, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
phlax:load-aware-locality-test-sim-time

Conversation

@phlax

@phlax phlax commented Nov 7, 2026

Copy link
Copy Markdown
Member

LoadAwareLocalityIntegrationTest::advanceWeightTick() called advanceTimeWait(11s) on the real time system, i.e. it slept 11s per weight-update period. Ten ticks per IP version made the (unsharded) target run ~250s, hidden behind size = "large", and it regularly ends the test phase of CI jobs that invalidate test/integration.

Use simulated time for the fixture: the LB's weight-update timer runs on the main dispatcher and the utilization freshness check compares monotonic timestamps, so advancing simulated time by the same 11s drives exactly the same tick with the same inputs. Drop the test size.

sendRequestWithOrcaResponse() opened a downstream connection, waited for a fresh upstream connection and closed both for every one of the ~1000 requests each IP version sends. Keep the downstream connection and one fake connection per upstream open for the duration of a test and wait for the next stream on any of them, so the sampling exercises Envoy's pools the way traffic would and the test no longer spends its time on connect/close pairs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The simulated-time and connection-reuse changes have no active review issues.

No open issues 🎉

What changed in this PR

This PR reduces load-aware locality integration test overhead by using simulated time for weight updates and reusing connections across requests.

Changes:

  • Replace real-time waits with simulated time in the test fixture.
  • Reuse downstream and per-upstream connections, closing them during teardown.
  • Remove the test’s large size designation and add the simulated-time dependency.
File Description
test/​extensions/​load_balancing_policies/​load_aware_locality/​integration_test.cc Use simulated time and persistent connections for load-balancer sampling.
test/​extensions/​load_balancing_policies/​load_aware_locality/​BUILD Add the simulated-time dependency and remove the large test size.

Review effort: Balanced

@phlax
phlax force-pushed the load-aware-locality-test-sim-time branch from 4c6c913 to a453756 Compare November 11, 2026 23:33
@phlax

phlax commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

@nezdolik @tonya11en ptal - rebased to main.

`LoadAwareLocalityIntegrationTest::advanceWeightTick()` called
`advanceTimeWait(11s)` on the real time system, i.e. it slept 11s per
weight-update period. Ten ticks per IP version made the (unsharded)
target run ~250s, hidden behind `size = "large"`, and it regularly ends
the test phase of CI jobs that invalidate `test/integration`.

Use simulated time for the fixture: the LB's weight-update timer runs on
the main dispatcher and the utilization freshness check compares
monotonic timestamps, so advancing simulated time by the same 11s
drives exactly the same tick with the same inputs. Drop the test size.

`sendRequestWithOrcaResponse()` opened a downstream connection, waited
for a fresh upstream connection and closed both for every one of the
~1000 requests each IP version sends. Keep the downstream connection
and one fake connection per upstream open for the duration of a test
and wait for the next stream on any of them, so the sampling exercises
Envoy's pools the way traffic would and the test no longer spends its
time on connect/close pairs.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax force-pushed the load-aware-locality-test-sim-time branch from a453756 to a749843 Compare November 13, 2026 13:22
@phlax phlax added the backport/review Request to backport to stable releases label Nov 13, 2026

@ravenblackx ravenblackx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like something that would be good as a standard integration test helper function rather than implemented for only this one test, but this is fine.

@phlax
phlax merged commit b65ee4b into envoyproxy:main Nov 13, 2026
25 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49074)

`LoadAwareLocalityIntegrationTest::advanceWeightTick()` called
`advanceTimeWait(11s)` on the real time system, i.e. it slept 11s per
weight-update period. Ten ticks per IP version made the (unsharded)
target run ~250s, hidden behind `size = "large"`, and it regularly ends
the test phase of CI jobs that invalidate `test/integration`.

Use simulated time for the fixture: the LB's weight-update timer runs on
the main dispatcher and the utilization freshness check compares
monotonic timestamps, so advancing simulated time by the same 11s drives
exactly the same tick with the same inputs. Drop the test size.

`sendRequestWithOrcaResponse()` opened a downstream connection, waited
for a fresh upstream connection and closed both for every one of the
~1000 requests each IP version sends. Keep the downstream connection and
one fake connection per upstream open for the duration of a test and
wait for the next stream on any of them, so the sampling exercises
Envoy's pools the way traffic would and the test no longer spends its
time on connect/close pairs.

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit b65ee4b)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49074)

`LoadAwareLocalityIntegrationTest::advanceWeightTick()` called
`advanceTimeWait(11s)` on the real time system, i.e. it slept 11s per
weight-update period. Ten ticks per IP version made the (unsharded)
target run ~250s, hidden behind `size = "large"`, and it regularly ends
the test phase of CI jobs that invalidate `test/integration`.

Use simulated time for the fixture: the LB's weight-update timer runs on
the main dispatcher and the utilization freshness check compares
monotonic timestamps, so advancing simulated time by the same 11s drives
exactly the same tick with the same inputs. Drop the test size.

`sendRequestWithOrcaResponse()` opened a downstream connection, waited
for a fresh upstream connection and closed both for every one of the
~1000 requests each IP version sends. Keep the downstream connection and
one fake connection per upstream open for the duration of a test and
wait for the next stream on any of them, so the sampling exercises
Envoy's pools the way traffic would and the test no longer spends its
time on connect/close pairs.

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit b65ee4b)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
…49074)

`LoadAwareLocalityIntegrationTest::advanceWeightTick()` called
`advanceTimeWait(11s)` on the real time system, i.e. it slept 11s per
weight-update period. Ten ticks per IP version made the (unsharded)
target run ~250s, hidden behind `size = "large"`, and it regularly ends
the test phase of CI jobs that invalidate `test/integration`.

Use simulated time for the fixture: the LB's weight-update timer runs on
the main dispatcher and the utilization freshness check compares
monotonic timestamps, so advancing simulated time by the same 11s drives
exactly the same tick with the same inputs. Drop the test size.

`sendRequestWithOrcaResponse()` opened a downstream connection, waited
for a fresh upstream connection and closed both for every one of the
~1000 requests each IP version sends. Keep the downstream connection and
one fake connection per upstream open for the duration of a test and
wait for the next stream on any of them, so the sampling exercises
Envoy's pools the way traffic would and the test no longer spends its
time on connect/close pairs.

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit b65ee4b)
Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/review Request to backport to stable releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants