Scaling Node.js Applications - Index
What is the problem with respect to scaling Node.js applications
Node.js is single-threaded
Node.js can offload many of its tasks to the OS kernel
But Node.js requests can get queued up when Node.js main thread is blocked
Because Node.js is single threaded, adding additional CPU cores cannot solve the scalability issues.
How do we scale our Node.js applications with worker threads?
We can leverage worker threads to execute CPU intensive tasks to free up the Node main thread
With worker threads, we can achieve vertical scalability
How do we scale our Node.js applications with multiple Node instances?
We can run more than one instances of the Node.js server
Instances of Node.js server can also be run across machines.
Running instances of Node.js across virtual machines enables horizontal scalability
Considerations when scaling Node.js setups with multiple Node instances
A node process should not store session-specific stuff in it's own memory
A node process should store session-specific stuff in a common store
What are some ways to manage scalable Node.js setups?
Nginx with systemd
pm2
Docker with devops automation on the cloud
Dockerized node deployments on the cloud enable horizontal scalability
Want to be notified via email when a new explainer is added?
Submit
Want to be notified when I add a new explainer?
Submit
I create about one or two of these every month (whenever I find time between my webdev work) & you can unsubscribe at any time. 💨
Copyright (c) 2017-2024 Tezify All Rights Reserved. Created in India. GSTIN : 24BBQPS3732P1ZW.