Do Sleep/Await consume resources?

Workflow.sleep(123);
&
Workflow.await(123), () -> myCondition);

  • Do they consume resources (memory/cpu/thread/temporal worker)?

Workflow.await(() -> varThatWillBeSetToTrueWhenIgetSignal);

  • Does waiting for a signal have an impact on Temporal Queues?
1 Like

Sleep and await both suspend workflow execution which is later recovered (when timer fires or condition is evaluated to true). A workflow that is blocked/suspended for a long time does not consume resources on your worker(s).
Temporal Java SDK uses real threads, and depending on your load you should look into making sure your worker configuration is configured to handle the load. See this thread for worker tuning options.

Signals are delivered to your workers via task queues, and they are recorded in workflow history.

1 Like

Just to clarify @tihomir answer about signals.

Does waiting for a signal have an impact on Temporal Queues?

Delivering signals creates a new workflow task that has an impact on task queues. But waiting on a signal doesn’t affect task queues at all.

1 Like