Skip to main content

Execution timeouts

Stops execution when it exceeds a time budget.

Practices implemented

Applies to

  • GraphQL servers
  • Gateways and proxies

Configuration (suggested defaults)

ParameterDefaultNotes
queryTimeoutMs15000Queries should be fast.
mutationTimeoutMs60000Mutations may take longer.
subscriptionPayloadTimeoutMs15000Subscriptions are ongoing, limit each payload.

Implementation notes

  • Apply timeouts at the operation level.
  • Ensure resolvers can observe cancellation.
  • Subscriptions should not have timeouts (they are expected to run indefinitely), but each event should have a timeout in production. Failure to meet this timeout should cancel the entire subscription.
  • Log timeout failures with trace IDs.

Cautions

  • Long-running operations may fail unexpectedly.
  • Cancellation support varies across runtimes.
  • Beware thundering herd when many operations are canceled around the same time.

Problems addressed