adamvduke / node-apn-server

An http server written in Node.js to send apple push notifications
MIT License
55 stars 6 forks source link

How well would this scale? #2

Open wtsnz opened 11 years ago

wtsnz commented 11 years ago

Hi Adam,

Not as issue as such. Was just wondering how well this approach with creating all the connections to the apns for each app would work. What is here is a great solution to multiple apps on one server (replicating parse.com, urbanairship and the likes) but is there a maximum connections a node.js instance will make to apple? And what would happen if you have (hypothetical, of course) 100,000 'apps' using that one connection.js file?

Cheers, Will

adamvduke commented 11 years ago

@wtsnz The question of scaling is actually interesting, and the answer at this point is I don't know. The push server started as a proof of concept and I haven't used it in production or tried to scale it as of yet.

I previously considered it a bit and my initial thoughts were to not necessarily open a connection for each application right away (as is the current behavior), but only once a request to send a notification for a particular application is made. Subsequently that connection would be cached for some length of time (10-20 min) and the expiry would be updated on each new notification to be sent. If any particular connection reaches it's expiry age it could be closed/dropped.

As I understand it the scalability would be most limited by the underlying memory footprint of a tls connection. There is a bit of information out there about large memory usage in node using tls connections, but my initial search turned up things that seem to be a bit outdated at this point. See here. I'd be curious what the same test would yield with the current state of the node ecosystem.

If you have any thoughts on improving the scalability I'd be interested to hear them. -Adam