Endpoints and GCM: is it possible to send notifications to thousands of clients dealing with time limits?

64 views
Skip to first unread message

Massimo Di Cosimo

unread,
Apr 3, 2015, 10:05:44 AM4/3/15
to google-a...@googlegroups.com
Hello there,
I found the tutorial about App Engine Backend with Google Cloud Messaging and I successfully tested it.
Now I would like to extend it to something closer to a real application.
For example I would like to send a notification or a message to thousands of clients (my Android app is installed on thousands of tablet/phones).
If I understand correctly, Endpoints undergoes time limits of App Engine (https://cloud.google.com/appengine/docs/java/requests#Java_The_request_timer).
So, what is the most proper way to do this?

For examples, sometimes sending through GCM requires retries with exponential backoff and this could occasionally lead to exceed the maximum time allowed for handing a request in GAE.
I have some solutions in mind, but before reinventing the wheel, I would like to know if there is some tutorial or code already existing that could lead me to the correct approach.

Thank you,
Max

Adam

unread,
Apr 10, 2015, 6:56:51 PM4/10/15
to google-a...@googlegroups.com
In this case you would generally want to use a task queue [1]. Sending a message to many clients with retry would be considered background work and not something to fit into a request window which needs to complete quickly. Your endpoints methods can kick off tasks asynchronously and then return a response before the deadline.

Its good to remember that the "request" timer is due to need for a relative fast response to an HTTP request, but this does not mean all of your app logic needs to fit inside these request / response windows. This is where async processing like task queues comes in to help your apps scale.

Massimo Di Cosimo

unread,
Apr 11, 2015, 2:16:59 AM4/11/15
to google-a...@googlegroups.com
Thank you Adam.
It was my first option and I'm doing some experiments.
Are you aware of any tutorial or sample code that could simplify my work?
Thank you,
Max
Reply all
Reply to author
Forward
0 new messages