Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send batches of million push notifications using Amazon Simple Notification Service (SNS)

Tags:

Like many companies, the one I work for isn't comfortable in using Apple's APNS: No official library, stream that get cut-off randomly, etc... The same goes for Android's push system: Limited to small batches, completely different to Apple's APNS... That's why we are looking for an alternative and when Amazon claimed to be able to send millions of push notifications almost for free, we thought that SNS would be the perfect solution.

The issue is that we frequently have more than one million devices to address, and obviously our push campaigns rarely target the same devices. As far as we dug, the only solution is to use the AWS API that only provides a method to create the endpoints one at a time! That is a big deal for us because after some testing, we figured that in order to create 1 000 000 endpoints, it would take approximately 15h (~17 calls/sec).

Even after all the endpoints are created, in order to send all the pushes at once, the endpoints need to be added to a topic, and again, this has to be done one endpoint at a time (so 15 more hours). Event if we multithreaded our calls to let's say 30 threads, it would still take an hour!

So, could anyone tell us if there is anything that we missed? Is Amazon really expecting us to flood their webservices during 30 hours in order to create one push campaign? How can they pretend to send a million pushes in a second if it takes hours to prepare it? Are they working on a batch API for SNS? Is it possible to plug an Amazon DB containing the tokens to feed an SNS topic?

like image 754
pimpreneil Avatar asked Jun 20 '14 14:06

pimpreneil


People also ask

How do I set up push notifications on Amazon?

Open the Amazon Pinpoint console at https://console.aws.amazon.com/pinpoint/ . On the All projects page, choose the project that you want to update push notification settings for. In the navigation pane, under Settings, choose Push notifications. Next to Push notifications, choose Edit.

How many notifications publishes are under the free tier for SNS?

Amazon SNS also includes a Free Tier, where users can get started with Amazon SNS for free. Each month, Amazon SNS customers incur no charges for the first 1 million Amazon SNS requests, no charges for the first 100,000 notifications over HTTP, and no charges for the first 1,000 notifications over email.

What is the difference between AWS SNS and SQS?

Differences between SQS and SNS configurationsAn SQS message is stored on the queue for up to 14 days until it is successfully processed by a subscriber. SNS does not retain messages so if there are no subscribers for a topic, the message is discarded. SNS topics may broadcast to multiple targets.


1 Answers

It looks like Amazon provides a few methods of adding endpoints/tokens, including a CSV importer (but limited to 2MB csv files at a time). They also provide an API and sample java application for bulk uploading tokens (link).

The topic subscription point is addressed by an Amazon SNS employee here, essentially explaining that there is no batch API available for this unfortunately.

There are a few other 3rd party push notification providers that may better meet your needs when it comes to frequently creating custom segments/topics:

  1. OneSignal (Disclosure: I run this company)
  2. MixPanel
  3. Parse
like image 189
Gdeglin Avatar answered Jan 03 '23 04:01

Gdeglin