I need a messaging service that allows me to create a channel for each user in order to facilitate real-time notifications. If I have somewhere between 100,000 and 1 million users, does it make sense to create an SQS queue for each of these users?
According to the SQS pricing documentation it would only cost $0.40 to create 1 million queues, but would I run into scaling problems?
Also, is there a way to set an expiration date on a queue? If a user deletes their account, then their queue no longer needs to exist.
Creating queues is not an issue here. Polling or even long polling the queue is going to be really expensive for you. In order to process real-time notifications, you need to poll every queue, 1M of them for lets say every 5 seconds.
Based on SQS Pricing, Price per 1 Million Requests after free tier is $0.00000040 per request.
That means you will be calling the ReceiveMessage API for about:
1000000 queues * 17280 (1 day in seconds / 5 seconds) = 17280000000 times.
Which is about $6912.00 per day for the worst case scenarios.
You need to architect the solution in a better way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With