Cloud workflow orchestration
What a workflow coordinates
A workflow is a sequence of related tasks with rules for what happens next. An orchestrator coordinates those tasks, records progress, chooses branches and handles waiting or failure. At Byte Books, an order can reserve stock, wait for an approval, attempt a mock payment and then complete. Rather than keeping an HTTP request open while the order progresses, return an accepted response with an order identifier and expose a separate status.
A state machine describes allowed states and transitions. A state is a meaningful stage, such as reserved; an event or task result causes a transition. A terminal state ends the normal process. Workflow inputs identify the order and quantities; task outputs carry only needed information, such as a reservation ID and result. Keep sensitive values out of execution histories.
Orchestration and choreography
In orchestration, one workflow coordinates the business process and asks services to act. In choreography, services react to events and publish their own outcomes without a single controller selecting every next step. For example, inventory listens for OrderAccepted and publishes StockReserved; payment reacts to StockReserved. Both designs require stable event IDs, explicit ownership and failure handling. A centralized coordinator simplifies inspecting a process but introduces a dependency; choreography reduces direct coordination coupling while making end-to-end status and recovery harder to reason about. A mixed design is often useful: orchestrate order fulfillment while publishing OrderCompleted for independent analytics.
Accept -> Reserve -> Approval -> Mock payment -> Complete | | | Reject Denied Unknown result | | Release Reconcile result | | Compensated Complete OR ReleaseThis is a conceptual state diagram. Each transition must have a defined result, including approval expiry, release failure and terminal status. Independent tasks may run in parallel only when their data dependencies and compensation rules permit it.
Bound retries, waits and deadlines
A retry repeats an operation after a transient error. A timeout is a limit on waiting for a result; it does not prove that the remote operation stopped. A deadline bounds the entire process. For three total attempts, each capped at 4 seconds, with waits of 2 and 4 seconds, the modeled upper bound is 18 seconds (12 + 6), excluding orchestration overhead. If the total deadline is 15 seconds, the full sequence cannot fit. Set both an attempt limit and an overall time budget, and use bounded backoff with jitter in production to reduce synchronized retry spikes. Do not retry permanent validation errors. For ambiguous side effects, query the result or use a stable idempotency key before retrying.
A durable wait persists workflow progress instead of holding a worker busy. For a human approval, record the expected approver role, order ID, approval deadline and one-time decision. Authenticate and authorize the callback, correlate it to the waiting execution and reject stale or repeated decisions. A scheduled trigger starts work at a chosen time; it does not guarantee completion by that time. A queue can buffer individual work items. Neither alone replaces multi-step state tracking.
Compare orchestration products
- AWS Step Functions: state machines describe tasks, decisions and waits. Standard and Express have different execution guarantees and integration modes; Standard supports callback and job-wait patterns for supported integrations. A Standard execution guarantee does not make an external payment atomic with workflow progress. Retry and recovery can cause repeated task attempts.
- Azure Logic Apps: trigger-and-action workflows with managed and built-in connectors, useful for connecting business systems. Durable Functions: code-based orchestration using persisted history and replay; keep orchestrator code deterministic and place side effects in activities. Do not assume activities execute only once.
- Google Cloud Workflows: coordinates HTTP requests and service connectors, supports branching, retry and callback waits. Cloud Tasks dispatches queued individual tasks, while Cloud Scheduler initiates scheduled jobs. A task starting a workflow can be acknowledged before that workflow finishes.
Select using expected wait duration, execution semantics, connectors, authentication, deployment mode, history retention, quotas and billing. The products are not API-equivalent. Source anchors: AWS integration patterns, Azure Logic Apps, Durable orchestration, Google Workflows, Tasks versus Scheduler. Official excerpts reviewed 2026-11-28.
Estimate activity and observe completion
For a fictional billing model, 1,000 successful executions use six billable operations each and 100 retries add one operation each. At a hypothetical $0.01 per 1,000 operations, the operation charge is $0.061. This excludes task compute, connectors, logging, storage, network and failed paths. Real products meter differently; check current rates and what counts as an operation. A long wait may affect duration-based billing, but not every service meters waiting in the same way.
Record workflow ID, order ID, state, task attempt, elapsed time and sanitized outcome. Monitor failures, timeouts, old waiting executions and completion latency. Alert on stuck states and reconcile business records, not just successful workflow starts. Practice: draw the order workflow and calculate its retry time bound; then explain what happens if a callback arrives after expiration.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Cloud workflow orchestration — knowledge check
Choose the best answer for each offline scenario.
What distinguishes orchestration from choreography?
Three attempts of 4 seconds with delays of 2 and 4 seconds take at most how long in the simplified model?
Which approach fits a callback-based approval?
What is Google Cloud Scheduler mainly used for?
Why must Durable Functions orchestrator code be deterministic?