Workflow and Activity retries

I wanted to understand how Workflow and Activity retries are implemented in Temporal. As per my understanding, Temporal creates corresponding Timers in the Executions table. Then these Timer tasks are moved to the Task Queues. Please let me know if this is correct.

  • Also, which component moves the Timers to Task Queues?
  • What happens if that component fails to move them?
  • Does temporal follow the same process for Local Activities?

Also, I have a question about Workflow executions. During workflow executions, which tables are updated (Executions is one of them) and how are they kept in sync without transactions?

I wanted to understand how Workflow and Activity retries are implemented in Temporal. As per my understanding, Temporal creates corresponding Timers in the Executions table. Then these Timer tasks are moved to the Task Queues. Please let me know if this is correct.

The timers are created in the executions table. But they are never moved to task queues. Task queues are only for tasks that are delivered to activity and workflow workers.

  • Also, which component moves the Timers to Task Queues?

Timers are not moved to Task Queues. So no such component exists.

  • Does temporal follow the same process for Local Activities?

No, local activities are retried locally by the workflow worker. Then if the retry interval becomes too large they use server-side timer to schedule the next retry.

Also, I have a question about Workflow executions. During workflow executions, which tables are updated (Executions is one of them) and how are they kept in sync without transactions?

My Designing A Workflow Engine from First Principles talk at the @Scale 2021 conference provides the high-level explanation. See this old Cadence video that goes into more details.

I wanted to understand how Workflow and Activity retries are implemented in Temporal.

When an activity fails and should retry according to its retry policy a timer is created in the correspondent shard. When the timer fires the new activity task is scheduled and the correspondent task is added to the shard transfer task queue. Then the task executes adding the task to the activity task queue.

1 Like