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 + method
if thetps
is configured for a method. Otherwise, just usesserviceKey
.tps
for a method has higher priority then for a service. - Let's take the service
DemoService
for example, which contains methodA
and methodB
C
.DemoService
is configured withtps = 10
, MethodA
is configured withtps = 20
, while MethodB
C
isn't. Then we should useDemoService#A
as the key for method A, and set its token to20
. Also, we should useDemoService
as the key for method B and any other methods inDemoService
, and set its token to10