temporalio / temporal

Temporal service
https://docs.temporal.io
MIT License
11.93k stars 841 forks source link

API for setting RPS limits for activity tasks dispatch #6758

Open Shivs11 opened 2 days ago

Shivs11 commented 2 days ago

Is your feature request related to a problem? Please describe. Currently, users are able to control the activity task dispatch RPS (rate per second) as a configuration option before instantiating a worker. After a worker has started and polls for tasks, this RPS value can only be changed by re-deploying the workers. This has proved to be a pain-point for some users

Describe the solution you'd like I shall be working on implementing an API which shall allow customers to set this RPS limit. My implementation shall also prevent re-deploying of new/existing workers for changing the RPS value.

Describe alternatives you've considered NA - This seems to be a good solution to solve the problem at hand.

Additional context This is how customers set this limit, as of today:

w := worker.New(c, "hello-world", worker.Options{
        TaskQueueActivitiesPerSecond: 100, // default value: 100K
    })
spsoto commented 1 day ago

What happens to TaskQueueActivitiesPerSecond when the value is set via API? Does it get it ignored?

Shivs11 commented 10 hours ago

The idea is that the API set values would have the highest preference for these limits. So yes, TaskQueueActivitiesPerSecond will be ignored if you would have set a value using the API. This will effectively stop/remove the flapping behaviour thats present with the worker option.

Care will also be taken to have an "unset" feature for the API for those users who prefer to use the worker option as a way for setting the API limit. In that case, when unsetting is done, the value will be set the way it's being set as of today.