Hi everyone, I am new to Temporal and currently prototyping a small workflow that coordinates a few sequential API calls and file processing steps. Moving away from brittle cron jobs and manual state tables in a database already feels like a huge relief, especially when inspecting execution history in the web UI.
One area I want to get right early is configuring activity timeouts and retry policies. It is tempting to leave broad defaults everywhere, but when calling third-party endpoints that occasionally rate-limit or stall, distinguishing between start-to-close timeout and schedule-to-close timeout matters a lot more than I first expected. Setting realistic heartbeat timeouts for longer batch steps also helps workers recover cleanly after unexpected restarts.
Right now I am tagging validation errors and bad input payloads as non-retryable so workflows fail fast instead of burning retries on something that will never succeed. Meanwhile, transient network timeouts get an exponential backoff with a reasonable maximum interval.
For those running Temporal in production with external webhooks or HTTP activities, how do you typically tune your initial interval and backoff coefficient without hammering slow upstream services? Any rules of thumb you follow would be very helpful. Having clear examples of practical timeout boundaries will help me avoid common pitfalls before adding more background jobs to the worker.
Your split (non-retryable for bad input, backoff for transient) is already the most important part. A few rules of thumb that tend to hold up for third-party HTTP calls:
Timeouts
- StartToClose = one attempt. Set it to slightly above the slowest healthy response you’d accept (e.g. p99 × 2), not to “how long the whole thing may take”. If the HTTP client has its own timeout, keep it a bit below StartToClose so you get a clean client error instead of Temporal killing the attempt mid-request.
- ScheduleToClose = the total budget including all retries. This is the one that stops a stalled upstream from retrying forever, so it’s worth setting explicitly on anything external (the default retry policy has unlimited attempts).
- Heartbeat timeout only on the long batch steps, and heartbeat with progress (e.g. last processed offset) so a retry after a worker restart can resume rather than start over.
- ScheduleToStart you can usually leave unset unless you want to detect “no workers polling”.
Retry policy
- Defaults are initial 1s, coefficient 2.0, max interval 100× initial. For a slow or rate-limiting API, something like initial 2–5s, coefficient 2, max interval 1–5 min is a common starting point; the max interval matters more than the coefficient once you’re past a few attempts.
- If the upstream returns 429 with
Retry-After, raise an application error with an explicit next retry delay (the SDKs support next_retry_delay / NextRetryDelay on application errors) so you honour the server’s hint instead of your generic backoff.
- Treat 4xx other than 408/429 as non-retryable, like you’re doing for validation errors.
Not hammering the upstream
Backoff only helps per activity. If many workflows hit the same API at once, the real protection is a rate limit on the worker/task queue (maxTaskQueueActivitiesPerSecond limits across all workers on that queue, maxActivitiesPerSecond per worker), ideally with those calls on their own task queue so other activities aren’t throttled with them.
Also keep in mind activities are at-least-once: if the API supports idempotency keys, deriving one from workflow ID + activity ID makes retries of POSTs safe.