[Reference] JS Conf Talk - Scaling Nodejs beyond ordinary

I recently watched this talk Scaling Nodejs beyond ordinary made by Abhinav Rastogi at JSConf Iceland.

The talk is given by the Lead UI Engineer of Flipkart, which is one of the leading e-commerce ventures in India. The talk goes into the challenges Flipkart faced while scaling their services and the various approaches that helped them out in the thick of it.

Coming from a non CS background, I learnt a lot from watching this. I found it useful to get an overview of different concepts encountered when scaling applications. I likely got a good bit of it wrong but it was riveting nonetheless.

In this post I’m compiling my notes from watching this talk.

Approach to Scaling/ Optimization cycle

Approach to Scaling

This encompasses the high level framework to approach scaling.

Directions to scale

There are three directions to scale a system

  1. Horizontal Scaling - This comprises adding more servers. This helps to introduce reliability and availability. The idea being that with multiple servers handling requests, failure of one would lead to routing of requests to other live servers. This might deteriorate performance but will prevent a complete black out of service.

  2. Vertical Scaling - This involves adding more resources to the hardware you already have. The equivalent of adding more RAM and disk space to your server.

  3. Application layer optimizations - This involves optimizations to better use the resources you already have. For instance, Nodejs being single threaded will use only a single core on a multi-core system. By using a process manager such as PM2 and running multiple processes of the node application, we can use all the available cores.

This talk focuses on the application layer optimizations to better harness the resources one already has.

Which resources to profile?

The pre-cursor to optimization is profiling to identify the bottlenecks in the current system. The talk highlights which resources to profile, tools to profile the resources, the various bottlenecks they ran into and the approaches they took to fix those bottlenecks.