Aias00 opened a new issue, #6578:
URL: https://github.com/apache/shenyu/issues/6578

   ## Description
   `getForExchange` (on the request path of every HTTP/WebSocket/Dubbo proxy) 
unconditionally allocates `new LoadBalanceData(...)` (which itself defaults to 
4 empty HashMaps), `buildMultiValueMap(headers)` (full header copy), 
`buildMultiValueMap(queryParams)` (putAll), and `buildCookies(cookies)`. But of 
all load balancers only `HashLoadBalancer` reads anything from 
`LoadBalanceData`, and only `data.getIp()`. 
Random/RoundRobin/P2C/LeastActive/ShortestResponse read nothing.
   
   ## Location
   ```
   shenyu-plugin-base/.../utils/LoadbalancerUtils.java:69-99
   callers: DividePlugin.java:114/116, WebSocketPlugin.java:99, 
DefaultRetryStrategy.java:123, ApacheDubboProxyService.java:144
   ```
   
   ## Impact
   3 HashMaps + LoadBalanceData per proxied request — significant short-lived 
garbage at high RPS for the 5 of 6 LB algorithms that don't use the data.
   
   ## Suggested fix
   Make `LoadBalanceData` lazy — pass the `ServerWebExchange` and resolve 
fields on demand, or only build the sub-maps when an algorithm actually 
requests them. Remove the `new HashMap<>()` field initializers in 
`LoadBalanceData`.
   
   ## Related existing issue(s)
   None
   
   _Identified during the 2026-08-02 audit; full list in 
[`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._


-- 
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]

Reply via email to