Understanding activity retries

Hi there,

I have to predict the duration of a workflow where the duration depends on some user-provided parameters, at first I’ll average between best and worst case.
In order to be able to compute the worst case, I need to take into account the max activity duration, retries included.

let’s say I have the following activity options:

ao := workflow.ActivityOptions{
	StartToCloseTimeout:    time.Minute,
	ScheduleToStartTimeout: time.Minute,
	HeartbeatTimeout:       time.Second * 2, // such a short timeout to make sample fail over very fast
	RetryPolicy: &temporal.RetryPolicy{
		InitialInterval:    time.Second,
		BackoffCoefficient: 2.0,
		MaximumAttempts:    100,
		MaximumInterval:    time.Minute,
  1. the max duration of a single activity will be StartToCloseTimeout + ScheduleToStartTimeout although the retry policy would last more?

  2. StartToCloseTimeout is the timeout of every single execution attempt?


ScheduleToStart timeout is nonretryable as such retry would be putting it back into the same task queue. I would recommend not setting it at all for the majority of situations.

StartToClose timeout is the maximum execution time for a single activity invocation.

I would recommend not setting RetryPolicy.MaximumAttempts, but rely on ScheduleToClose timeout which limits total time activity can execute including all the retries.

1 Like