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

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.

  1. The key of StatItem Map should be serviceKey + method if the tps is configured for a method. Otherwise, just uses serviceKey. tps for a method has higher priority then for a service.
  2. Let's take the service DemoService for example, which contains method A and method B C. DemoService is configured with tps = 10, Method A is configured with tps = 20, while Method B C isn't. Then we should use DemoService#A as the key for method A, and set its token to 20. Also, we should use DemoService as the key for method B and any other methods in DemoService, and set its token to 10