Aias00 opened a new issue, #7826: URL: https://github.com/apache/shenyu/issues/7826
## 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](https://github.com/apache/shenyu/blob/04f7c2e8b7d282f14510157a9ab0bfaab538ecac/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/DividePlugin.java#L210-L225) 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](https://github.com/apache/shenyu/blob/04f7c2e8b7d282f14510157a9ab0bfaab538ecac/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/DividePlugin.java#L181-L192) builds the selected upstream's key again for outcome recording. - [UpstreamCircuitBreaker.buildKey():96–97](https://github.com/apache/shenyu/blob/04f7c2e8b7d282f14510157a9ab0bfaab538ecac/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/circuitbreaker/UpstreamCircuitBreaker.java#L96-L97) 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. #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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
