I am about to build a push notification service for iOS (android in the future). I don't know at the moment how much load it should handle, but let's assume it's 500 requests per second. it might be lower, but i would rather built it to handle it.
I found a good post about flickr - http://code.flickr.net/2012/12/12/highly-available-real-time-notifications/ they have 1..n (php) http servers that send reuests to Redis. Redis publish each request to at least 2 node severs (2 data centers) that 'compete' on doing the push (using locking feature of Redis). so a single Redis is the center of the activity, and as long as it's running, there is no loss of notifications but Redis it's a single point of failure. maybe they have some way to replicate Redis, but they didn't mention it? 1) What about the following approach: http request -> load balancer -> 1..n machines each with node and Redis. The load balancer will make sure to send each request to different node+redis instance. When request comes, I'll make a call to MongoDB (see #2), see if the device id is a registered device and ony than i'll save the data in Redis, make the push to Apple and update the status in Redis. I'll also have some background process that retry the failed ones and I might create a web interface that query all the Redis instances and display info about failures/successes. In this approach there might be a bit more data loss (when server dies or crashes, but not on server restart) but code complexity and scaling seems easy. 2) I have other data (registered devices and info about different apps) that I plan to store in MongoDB and use replica-sets for redundency. on each request I'll have to access it before saving into Redis. if I feel that it's too slow to hit MongoDB on each request, i can load this data to memory when the server starts but i'll have to figure out what to do when the data on MongoDB changed. 3) Also, I don't know how APNS (apple push service) works yet. do I need to send it messages in batches or it will be fine with many individual messages (from different devices)? basic flow: device id found in Mongo? save in Redis send to apple update status in Redis Any suggestions/code samples/blog posts would be appreciated! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
