I have a use case where I want to throttle the number of request into a particular “Activity”. I throttled it using a child workflow where number of concurrent runs were limited.
I observed that these executions were randomised and not FIFO. Is there a way of achieving the same?
To limit the rate of execution of an activity use task queue rate limiting. Create a separate worker on a separate task queue for that activity and specify the rate limit for that task queue through
worker.Options.TaskQueueActivitiesPerSecond. This approach doesn’t guarantee FIFO.
To guarantee FIFO you have to pass all the requests through a single workflow instance. This approach doesn’t scale as a single workflow has limited throughput.
What is your use case for FIFO?
Hi @maxim ,
Sorry for the late response. We have an external dependency with throttling. We are already using temporal workflow. We introduced throttling in our external dependency by using child workflow.
However, we saw random behaviour in the child workflow execution. They were not FIFO. This resulted in a few workflow execution within seconds and few workflow wait time for more than 10 minutes.
What is the rate of activity executions for that external dependency? it it is not high then using a single workflow that schedules it is the way to go. Otherwise, I would rely on task queue rate limiting.
What is the rate of activity executions for that external dependency?
→ 3 activities concurrently to be executed for the external dependent activity.
Time taken for the external dependent activity is not large but we see few of the workflows stuck in waiting state and workflows that are registered later are executed before.