Does the await() call blocks the execution thread

Does the await() blocks the execution thread ? Or it’s suspends the flow and release it ?

We plan to use it as a batch aggregator, a signal will add to the batch and as soon the batch will meet size or time window requirements the messages will be processed by a child flow.

The question, is it better to use await or the timer sleep call, in order not to block the executing thread and cause performance degradation. Please advise ?

Thank you.

2 Likes

Does the await() blocks the execution thread ? Or it’s suspends the flow and release it ?

It suspends the workflow execution and later recovers it. So a workflow that is blocked for a long time doesn’t consume resources on the worker.

We plan to use it as a batch aggregator, a signal will add to the batch and as soon the batch will meet size or time window requirements the messages will be processed by a child flow.

Keep in mind that a single workflow instance cannot grow very large or process a large update rate. What is the batch size and number of signals per second processed by a single workflow execution (instance)?

1 Like

Thank you for a prompt response.

@maxim could you please elaborate why it cannot grow very large? and what is the limit

Temporal relies on the event history to recover workflow state through replay. So, a very long history would lead to long recovery times. The current limits are documented here: