Aetherance opened a new pull request, #3305:
URL: https://github.com/apache/dubbo-go/pull/3305

   ### Description
   
   Every RPC call executes the full router chain. TagRouter performs O(n) 
invoker traversal for every call, even though invoker lists and routing rules 
change orders of magnitude less frequently than RPC calls. This PR adds an 
invoker-snapshot cache on RouterChain so that Poolable routers can pre-compute 
address pools once per SetInvokers and reuse them across subsequent Route calls.
   
   Fixes #3166
   
   ### Approach
   - New `routerCache` on RouterChain, rebuilt in full on each SetInvokers. 
Implements the existing `router.Cache` interface.  
   - `CacheAccessor` interface lets Poolable routers receive the cache 
reference from RouterChain.  
   - TagRouter implements `Poolable` + `CacheAccessor`. `Pool()` builds a 
three-dimensional bitmap index (tag, addr/port, version/group) stored in a 
single AddrPool.  
   
   - Static tag matching, dynamic address matching, and indexed param matching 
all resolve via O(1) bitmap lookup instead of O(n) traversal.  
   
   - When a ParamMatch references a key not indexed (e.g. custom parameter 
outside version/group), the bitmap path gracefully falls back to the original 
filterInvokers-based logic.
   
   ### Checklist
   - [x] I confirm the target branch is `develop`
   - [x] Code has passed local testing
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to