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

   ## Description
   For each discovery handler `d` (H of them) it issues three separate mapper 
calls inside the lambda: 
`discoveryRelMapper.selectByDiscoveryHandlerId(d.getId())`, 
`selectorMapper.selectById(...)`/`proxySelectorMapper.selectById(...)`, and 
`discoveryUpstreamMapper.selectByDiscoveryHandlerId(d.getId())`. That is 3H+1 
round-trips. This method is the cache builder called by 
`AbstractDataChangedListener.updateDiscoveryUpstreamDataCache` on every 
discovery-upstream change, then broadcast to every gateway.
   
   ## Location
   ```
   shenyu-admin/.../service/impl/DiscoveryUpstreamServiceImpl.java:149-171
   ```
   
   ## Impact
   At scale (many proxy-selector handlers) each upstream change costs O(H) DB 
queries + O(H) in-memory fan-out.
   
   ## Suggested fix
   Fetch all `discovery_rel`, all `discovery_upstream`, and referenced 
selectors/proxy-selectors in three batched `IN (...)` queries, then stitch in 
memory.
   
   ## 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