...

/

Untitled Masterpiece

Learn how to use cloning and decomposing by functionality to scale Node.js applications.

Traditional, multithreaded web servers are usually only scaled horizontally when the resources assigned to a machine can’t be upgraded anymore, or when doing so would involve a higher cost than simply launching another machine.

By using multiple threads, traditional web servers can take advantage of all the processing power of a server, using all the available processors and memory. Conversely, Node.js applications, being single-threaded, are usually scaled much sooner compared to traditional web servers. Even in the context of a single machine, we need to find ways to “scale” an application in order to take advantage of all the available resources.

Note: In Node.js, vertical scaling (adding more resources to a single machine) and horizontal scaling (adding more machines to the infrastructure) are almost equivalent concepts: both, in fact, involve similar techniques to leverage all the available processing power.

Don’t be fooled into thinking about this as a disadvantage. On the contrary, being almost forced to scale has beneficial effects on other attributes of an application, in particular, availability and fault tolerance. In fact, scaling a Node.js application by ...