Dubbo Framework's Built-in Concurrent Control Strategy

Dubbo framework’s built-in concurrent control or rate limiting strategy prevents malicious requests from overloading the server by limiting the number of concurrent requests from the same client to the same service, ensuring service stability and preventing excessive resource usage.

Dubbo has implemented a built-in concurrency control strategy through the Filter interceptor mechanism. It limits the number of concurrent requests from the same client to the same service, preventing malicious requests from overloading the server, ensuring service stability, and preventing excessive resource usage.

  • Control the maximum concurrent requests for certain services to ensure the availability of resources for other services. Prevent system overload and ensure system stability.
  • Allow for smoother service scaling when demand increases.
  • Ensure service reliability and stability during peak usage times.

Rate Limiting Strategy Configuration

Limit Server-Side Concurrent Execution (Service Granularity)

Limit the concurrent execution (or occupied thread pool threads) for each method of com.foo.BarService to a maximum of 10.

XML format:

<dubbo:service interface="com.foo.BarService" executes="10" />

Annotation format:

@DubboService(executes=10)
private DemoServiceImpl implements DemoService{}

Limit Server-Side Concurrent Execution (Method Granularity)

Limit the sayHello method of com.foo.BarService to a maximum of 10 concurrent executions (or occupied thread pool threads).

XML format:

<dubbo:service interface="com.foo.BarService">
    <dubbo:method name="sayHello" executes="10" />
</dubbo:service>

Annotation format:

@DubboService(executes=10, methods = {@Method(name="sayHello",executes=10)})
private DemoServiceImpl implements DemoService{}

Limit Consumer-Side Concurrent Calls (Service Granularity)

Limit the concurrent execution (or occupied connection requests) for each method of com.foo.BarService to a maximum of 10 per client.

XML format:

<dubbo:service interface="com.foo.BarService" actives="10" />

Annotation format:

@DubboReference(actives=10)
private DemoService demoService;

Limit Consumer-Side Concurrent Calls (Method Granularity)

Limit the sayHello method of com.foo.BarService to a maximum of 10 concurrent executions (or occupied connection requests) per client.

XML format:

<dubbo:service interface="com.foo.BarService">
    <dubbo:method name="sayHello" actives="10" />
</dubbo:service>

Annotation format:

@DubboReference(actives=10, methods = {@Method(name="sayHello",executes=10)})
private DemoService demoService;

If both the provider @DubboService and the consumer @DubboReference are configured with actives, the consumer’s configuration value takes precedence. See: Configuration Override Strategy .

Minimum Concurrent Load Balancing

Set the loadbalance attribute of the service’s client to leastactive, this Loadbalance will call the provider with the least number of concurrent requests.

<dubbo:reference interface="com.foo.BarService" loadbalance="leastactive" />

Or

<dubbo:service interface="com.foo.BarService" loadbalance="leastactive" />