Orchestration vs Choreography
Coordinating multi-step workflows requires a pattern. Orchestration uses a central controller. Choreography relies on events and independent services.
Simple Explanation
What it is
Orchestration is a workflow engine telling each step what to do. Choreography is services reacting to events without a single coordinator.
Why we need it
Multi-step workflows can fail in the middle. You need a pattern that keeps the system consistent and recoverable.
Benefits
- Orchestration is easier to monitor and debug.
- Choreography is more decoupled and flexible.
Tradeoffs
- Orchestration can become a bottleneck if overused.
- Choreography can be harder to trace end-to-end.
Real-world examples (architecture only)
- Order workflow -> Step Functions -> Payments -> Inventory.
- Event stream -> Services react independently -> Final state emerges.
Orchestration Model
Best for:
- Complex workflows with clear step order
- Strong audit requirements
- Long-running business processes
AWS: Step Functions GCP: Cloud Workflows
Python example (start a workflow execution)
import json
import boto3
sfn = boto3.client("stepfunctions")
def start_workflow(order_id):
return sfn.start_execution(
stateMachineArn="arn:aws:states:REGION:ACCOUNT:stateMachine:OrderFlow",
input=json.dumps({"orderId": order_id}),
)
GCP Workflows call (Python)
import json
from google.cloud import workflows_v1
from google.cloud.workflows.executions_v1 import ExecutionsClient
workflows_client = workflows_v1.WorkflowsClient()
executions_client = ExecutionsClient()
def start_workflow(project_id, location, workflow_name, order_id):
workflow = workflows_client.workflow_path(project_id, location, workflow_name)
execution = executions_client.create_execution(
parent=workflow,
execution={"argument": json.dumps({"orderId": order_id})},
)
return execution.name
Choreography Model
Best for:
- High decoupling between services
- Independent teams owning steps
- Event-driven ecosystems
AWS: EventBridge, SNS/SQS GCP: Pub/Sub, Eventarc
Python example (event-driven)
import json
import boto3
eventbridge = boto3.client("events")
def emit_order_created(order_id):
eventbridge.put_events(
Entries=[
{
"Source": "orders",
"DetailType": "OrderCreated",
"Detail": json.dumps({"orderId": order_id}),
"EventBusName": "default",
}
]
)
Decision Matrix
| Requirement | Orchestration | Choreography |
|---|---|---|
| Clear step order | ✅ | ❌ |
| Independent teams | ❌ | ✅ |
| Easy debugging | ✅ | ❌ |
| Loose coupling | ❌ | ✅ |
| Long-running workflows | ✅ | ❌ |
Common Pitfalls
- Orchestration with too many tiny steps becomes hard to maintain.
- Choreography without good observability becomes a black box.
- Mixing both without clear boundaries leads to confusion.
Project
Design a three-step workflow (payment, inventory, notification) in two ways:
- Orchestrated workflow
- Event-driven choreography
Deliverables:
- Architecture diagrams for both approaches
- Failure scenario and recovery plan
- Which approach you recommend and why
Email your work to maarifaarchitect@gmail.com.
References
- AWS Step Functions: https://docs.aws.amazon.com/step-functions/
- EventBridge: https://docs.aws.amazon.com/eventbridge/
- Google Cloud Workflows: https://cloud.google.com/workflows/docs
- Pub/Sub: https://cloud.google.com/pubsub/docs/overview