Question

I want to use Amazon SNS to send time-critical mobile PUSH notifications to 20 million devices. Each topic can have up to 10,000 devices, and I can create up to 3,000 topics. Using the Amazon PHP SDK would mean sending 2000 API calls at 1 second each - 33 minutes in total. This is no good for time-critical messages.

I have created an SQS queue and subscribed that to the SNS topic. When I send my PUSH message to the SQS queue, it doesn't get delivered - it remains in the queue.

How can I use these services to send the messages more quickly?

Thank you!

Was it helpful?

Solution 4

Use Guzzle to send the requests in parallel.

$client->send(array(
    $client->get('http://www.example.com/foo'),
    $client->get('http://www.example.com/baz'),
    $client->get('http://www.example.com/bar')
));

OTHER TIPS

Did you check the Queue Policy? When you create it, by default it has no policy and only the owner is able to use it.

Check the IAM user you are using with the API and make sure you have the policy on the SQS granting rights to him.

I have used SNS in the past to deliver around 1.5MM notifications each month and I had no problems. But I have no proven track record or experience at the rate you need. But I suggest you to take a look at the following article http://www.quora.com/Push-Notifications/Which-is-best-to-use-Amazon-SNS-Google-Cloud-Messaging-or-Parse-Why which talks a little bit about SNS x GCM.

Hope this helps.

Since you don't specify the complete workflow of the notification I would be guessing, and my guess would be that you have a wrong approach.

For instance, if you need to send 100 push notification and for that you create a 100 SNS requests from your app at once, then you are adding an unnecessary layer of complexity. Just send the 100 push from your app and skip SNS.

The right way to do it is to fire a single SNS action that will hit all the workers and they will do the job on demand as they get the "order".

Hope that helps.

10,000 devices per topic * 3,000 topics would allow you to send a message to 30 million devices. Why not just duplicate your topic across all 3,000 topics and publish your message to each topic? Users would get subscribed to one of those 3,000 topics. I haven't actually tried this, but seems to be the most straight-forward approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top