Please enable JavaScript.
Coggle requires JavaScript to display documents.
Service Orchestration - Coggle Diagram
AWS Step Function
- Manage workflow by adding logics, tracking inputs/outputs
- State of flow is preserved up to 1 year if needed
Workflow
Standard (default)
- Priced per state transition, counted per step
- State can be preserved up to 1 year
- Exactly-once execution
Express
- Priced by the number of executions/duration/memory
- Alternative to Standard for small tasks, but state preserves up to 5 minutes only
- At-least-once execution
Async Express
- Express Workflow can be executed asynchronously
- Confirmation will return once the task is done
Tasks
- Dedicated tasks for Step Function
Activity
- Process/thread that is manually hosted by the user
Lambda Function
- Execute Lambda Function as the part of flow
AWS Service
- Directly call API of the supported AWS Services
- Batch job, scheduling ECS task, insert to DynamoDB, publish message to SNS/SQS, another Step Function
Wait
- Wait for a specific time duration or until the set timestamp
-
Error Handling
- In case of step function failure, the event can be sent to the EventBridge
Simple Queue Service (SQS)
- Simple FIFO pipeline with pub/sub
Batched Message
- The message can be batched together to a certain number before sent to services like AWS Lambda
- Great for reducing concurrency overheads
-
Message Timers
- Can set invisibility period of a specific message so that the consumer will not see the message in the set amount of time
- Minimum 0 seconds to maximum 12 hours
Delay Queue
- Special queue that postpone the delivery of messages for set amount of time
- Minimum of 0 seconds to maximum of 15 minutes
Dead Letter Queue (DLQ)
- SQS can be configured to forward the message that is looping indefinitely in the pipeline for retry
- The # of retries or amount of time can be set
- DLQ has retention period, so message will be lost after some time
Redrive
- Once consumer is fixed and able to consume the message, messages in DLQ can be re-added to the SQS
Amazon MQ
- Non-AWS based message queue brokers can be used with Amazon MQ
- Easier to migrate from existing on-premise infrastructure
- May not scale as well as SNS or SQS
Simple Notification Service (SNS)
- Pub/sub to send messages to multiple services
- A topic can have up to 12,500,000 subscription
- Can make up to 100,000 topics
Message Publishing
Topic Publish
- Create a topic and other services subscribe
- Publish a message to the topic
Direct Publish
- Usually for mobile application
- Google GCM, Apple APNS, Amazon ADM
Filter Policy
- The subscriber can optionally configure the filter to selectively receive the SNS messages
- Can filter based on the message content
Retry
- 4 phase process where each has a different policy
Immediate-Retry
- 3 times without delay
- 0 times if Customer managed
Pre-backoff
- 2 times, 1 second apart
- 10 seconds apart if Customer managed
Backoff
- 10 times, exponential from 1 to 20 seconds apart
- 10 to 600 seconds apart if Customer managed
Post-backoff
- 100,000 times, 20 seconds apart
- 38 times, 600 seconds apart if Customer managed
-
Fan Out Pattern
- Use SQS Queue as an intermediary between SNS topics and the receivers
FIFO Mode
- SQS and SNS can be optionally configured to have strict message ordering & deduplication
- The order of published message is always the same as the order of the message received
- If Pan Out Pattern is used, both SNS and SQS must enable FIFO Mode together
Amazon Simple Email Service (SES)
- Managed email service
- Application can use SES through APIs or SMTP
Message limits
- 300 API calls (send, receive, or deleted) per second
- Maximum of 10 batch of messages per operation
- In total, 300 * 10 messages / second is possible