2개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
4
Here are a few things I can think of:
- Batching: SQS uses batching to aggregate multiple events before invoking a Lambda function invocation. This can speed up processing by reusing hot code, reducing the number of Lambda function invocations (thus amortizing cold start overhead), and reducing the chance of encountering Lambda function execution concurrency limits. However, there is a possible latency tradeoff: if the event frequency is low, SQS may wait up to 20 seconds before flushing pending messages to Lambda.
- Observability: With SQS you can easily observe the length of the backlog of events that have not been processed by your Lambda function or that have failed processing. This can be useful for determining whether something is going wrong.
1
You will get the following benefits by using SQS : -
- helps in the retry mechanism if the lambda process fails.
- routes the messages to Dead Letter Queue after the retry limit is reached, which enables you to process them at a later time within the next 14 days(maximum). i.e persistent
- If you want to maintain the order of the messages then you can go with SQS FIFO.
- Multiple subscribers can poll from the same SQS, but a message can be processed only by 1 subscriber, unlike SNS. In the SNS scenario, as it is a push mechanism, all the subscribers can consume the message and trigger their own processes.
- SQS primarily used for decoupling sending and receiving components.
In case of SNS to Lambda:-
- It is good for time-critical processes
SNS -> SQS -> Lambda is a better approach if you need a Fan-Out De-coupled solution.
https://aws.amazon.com/blogs/aws/queues-and-notifications-now-best-friends/
답변함 2년 전
SNS, like SQS, also automatically retries delivery: https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html
SNS can also deliver failed messages to a DLQ: https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html
관련 콘텐츠
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 7달 전
The sqs also is a great candidate for load balancing the peak but sns not