githubEdit

Troubleshooting High Latency in SNS to SQS Message Delivery

If you're experiencing unusually high latency (several seconds or more) in message delivery from SNS to SQS, one common cause could be multiple SQS subscriptions on the same SNS topic. When an SNS topic has many subscribers, it can cause SNS to queue internally before delivering messages, leading to increased delivery times. How to Diagnose the Issue To determine if multiple subscriptions are causing the delay: Create a temporary SNS topic with only the essential SQS subscription Publish test messages to this new topic Monitor the delivery latency If the delivery latency drops significantly (to milliseconds) with the single subscription, this confirms that the delay was caused by SNS fan-out to multiple subscriptions. Solution Options If multiple subscriptions are confirmed as the cause, consider these approaches: Separate time-sensitive messages into dedicated SNS topics with fewer subscriptions Review and consolidate subscriptions where possible For critical operations like verification codes, use a dedicated topic-queue pair Note: Before concluding multiple subscriptions are the cause, ensure you've verified other potential issues such as: Filter policy configuration Cross-region delivery settings KMS encryption Message size Throttling limits

Last updated

Was this helpful?