Repository navigation
Description
Goal
Reduce repeated circuit-breaker key construction, list allocation and scanning in the HTTP divide request path, while preserving routing and breaker state-transition correctness.
Performance baseline/tracking: #7650. Reviewed revision: 04f7c2e8b7d282f14510157a9ab0bfaab538ecac (2.7.2-SNAPSHOT). These are confirmed source-level operations, not yet profiled bottlenecks. No fixed performance gain is claimed.
Current repeated work
- DividePlugin.filterByCircuitBreaker():210–225 allocates an allowed-list and constructs a breaker key for every candidate. If the allowed-list is empty, a second scan constructs keys again when attempting a half-open probe.
- DividePlugin.forwardWithCircuitBreaker():181–192 builds the selected upstream's key again for outcome recording.
- UpstreamCircuitBreaker.buildKey():96–97 concatenates selector ID and buildDomain(), producing request-time strings.
The cost grows with candidates/request and traffic rate. For one upstream at low rate it may be too small to justify a more complicated implementation.
Scope and acceptance criteria
- Profile a controlled upstream matrix with 1, 10, 100+ targets, mixed allowed/blocked candidates and all-blocked states. Record allocation/request, key-construction CPU, GC and p99 at equal successful throughput.
- Evaluate safe key/identity reuse and a bounded per-request or update-time representation. Avoid an unbounded global memoization map.
- Avoid rebuilding keys already computed for filtering when recording the selected target's outcome; avoid redundant scan/allocation only when selection semantics remain equivalent.
- Preserve selector/target isolation, identity changes, explicit target selection, load-balancing weights, retries and success/error/cancellation accounting.
- Cover concurrent half-open admission and configuration removal. [BUG] Built-in upstream circuit breaker does not enforce a single half-open probe #7760 already tracks half-open probe correctness; this optimization must not hide or worsen that issue and may need to follow its fix.
- Retain only measurable improvements; publish baseline/after commands, configurations and profiles. Do not replace correctness checks with an unchecked single-upstream shortcut.
Related work
#6584 introduced baseline breaker behavior; #7760 owns half-open admission correctness. The upstream snapshot/copy optimization is a separate ownership/publication change; this task should be measured independently so the benefit and correctness of each change remain reviewable.
Activity
[ISSUE #7826][ISSUE #7760] Reuse Divide keys and enforce one recovery…