temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Per task queue ratelimiting should only count valid activity tasks

Open yycptt opened this issue 2 years ago • 0 comments

Expected Behavior

Only valid (started) tasks should count towards per task queue ratelimiting. (when user specifies TaskQueueActivitiesPerSecond in worker config)

Actual Behavior

https://github.com/temporalio/temporal/blob/master/service/matching/matcher.go#L228

All tasks, regardless of whether its expired or failed to start or successfully started will consume token from the rate limiter, since we perform the rate limiting step when attempting a match.

For example when there's a backlog of expired tasks in the task buffer, all tasks will consume the rate limiting token and throttle how fast the backlog can be drained. However, from user/worker perspective, there's no dispatched tasks at all.

Steps to Reproduce the Problem

Specifications

  • Version:
  • Platform:

yycptt avatar Jul 26 '22 22:07 yycptt