Instagram co-founder Mike Krieger has now posted an explanation of how it kept up with those million new users in the first day. One of the most interesting details of the post was the fact that Instagram actually wrote its own push notification server for the Android app, and it is offering it up as open-source. The server has handled over 5 million notifications since the app launched:
Another tool that helped us get through the first day was one we wrote ourselves—node2dm, a node.js server for delivering push notifications to Android’s C2DM service. It’s handled over 5 million push notifications for us so far.
We surveyed the different options for C2DM servers, but didn’t find any open source ones that looked like they were being actively maintained, or fully supported the Google service. We’re open sourcing node2dm today; feel free to fork and pull-request if you have any suggestions for improvements.
Krieger offers several valuable lessons gleaned from scaling services on the level that Instagram does.
- Having realtime stats that can be added dynamically lets you diagnose and firefight without having to wait to receive new data.
- It’s often one piece of the backend infrastructure that becomes a bottleneck, and figuring out the point at which your real, live appservers get stuck can help surface the issue.
- If read capacity is likely to be a concern, bringing up read-slaves ahead of time and getting them in rotation is ideal; if any new read issues crop up, however, know ahead of time what your options are for bringing more read capacity into rotation.
If you’re an Android developer looking for a push server option, you can check out node2dm on Github here.