Pre-check
- [x] I am sure that all the content I provide is in English.
Search before asking
- [x] I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
3.3
Steps to reproduce this issue
Configure tps on different methods of one service.
What you expected to happen
Although I can now configure tps on a method level, the stats map in DefaultTPSLimiter is still using serviceKey as the key. So the method level TPS doesn't work. Like if I configure different tps numbers on different methods, they are actually sharing the same StatItem which is obtained by service key.
I check the related issue 9159. It just fetch the tps params from method configuration, but the DefaultTPSLimiter doesn't actually support per-method-level TPS.
Anything else
No
Are you willing to submit a pull request to fix on your own?
- [x] Yes I am willing to submit a pull request on my own!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Comment From: lingyufei
@zrlw I can work on this bug. Please assign it to me. Thanks.
Here is what I'm gonna do. Please check it looks good to you.
- The key of StatItem Map should be
serviceKey + methodif thetpsis configured for a method. Otherwise, just usesserviceKey.tpsfor a method has higher priority then for a service. - Let's take the service
DemoServicefor example, which contains methodAand methodBC.DemoServiceis configured withtps = 10, MethodAis configured withtps = 20, while MethodBCisn't. Then we should useDemoService#Aas the key for method A, and set its token to20. Also, we should useDemoServiceas the key for method B and any other methods inDemoService, and set its token to10