
Explore how to use NodeJS cluster for multi-core production, with PM2 for process management, RabbitMQ and Redis for messaging and caching, and Nginx as a reverse proxy and load balancer.
This course targets developers already working on NodeJS applications, especially those using Express JS for web application development, with basic knowledge of Ecmascript 2015; it is not for beginners.
Use the current Node.js LTS version and Microsoft Visual Studio Code, with optional IDEs like WebStorm or Sublime Text. Install RabbitMQ, Redis, Nginx, PM2, and Nodemon using the provided links.
Explore why Node.js cluster matters, covering non-blocking vs blocking operations, event loop and worker threads, and learn how clustering leverages multi-core systems to share a single port.
Discover how the node.js cluster module uses multicore systems by forking workers sharing a port and IPC with the master, round robin, and events online, fork, message, disconnect, and exit.
Utilize the cluster module to fork multiple worker processes, distribute incoming requests across CPU cores, and run an Express app on port 3000 that returns Fibonacci values.
Load test a node js cluster with a npm load test utility. Start the app with nodemon and simulate 1000 requests at 100 concurrent and 200 rps to http://localhost:3000.
Test a four-process NodeJS cluster with artillery to simulate ten virtual users sending twenty requests to localhost:3000, and review the report showing ten scenarios launched and 200 requests per second.
Discover how to run NodeJS applications in a cluster with PM2, using a built-in load balancer to keep apps alive, reload without downtime, and manage processes via ecosystem.config.js.
Run a node express app in cluster mode with PM2 by configuring ecosystem.config.js, launch four instances, and monitor via PM2 monitor and its web interface, followed by load testing.
Explore how the Node.js child_process module enables master-child communication using fork, IPC channels, and event emitters. Build a two-worker cluster that handles client requests while managing separate memory spaces.
Explore node.js cluster messaging by forking a master and two child processes, exchanging messages to compute fibonacci values and return results via an express server.
Harness PM2 and RabbitMQ to enable master and child process communication in a Node.js cluster, with two producers and two consumers processing queued messages.
Explore master and child process communication using PM2 and RabbitMQ, setting up two queues, producers and consumers, and testing with load tests to observe queue messages and worker behavior.
Explore the RabbitMQ management web interface to monitor queues, exchanges, and bindings, publish and inspect messages, manage users, and observe message rates and acknowledgements.
Explore Redis as an in-memory NoSQL key-value store, with data structures, caching, and pub/sub, in a Node.js cluster using PM2, including installation and basic set/get.
Cache Express.js rest API data with Redis in a Node.js cluster managed by PM2, using middleware and Json placeholder data to fetch, cache, and serve responses.
Learn how to implement Redis pub/sub with two publishers and two subscribers, publishing messages to a channel and listening for data via the Redis server, run with PM2.
Publish and subscribe messages using Redis in a Node.js app, with two subscriber workers and PM2 process management, routing even and odd numbers to fibonacci calculations via dedicated channels.
Explore how Nginx acts as a reverse proxy and load balancer, centralizing https certificates, caching, and distributing requests to applications. Understand its master and worker architecture and essential reload commands.
Configure nginx as a reverse proxy for an Express rest API clustered via PM2, routing requests to localhost:3000/gpg, with Redis cache, and reloads for changes.
Configure nginx as a load balancer and reverse proxy for two Express API instances, using an upstream cluster, separate ports 3000 and 3001, and proxy_pass to distribute requests.
Learn how to build a node.js cluster with the cluster module, run it in production with pm2, and use redis or rabbitmq and nginx for faster performance.
As we all know, Node JS is single threaded event-driven JavaScript runtime. When we run any CPU intensive operation, Node will not be able to take an advantage of all the cores of our machine. This is where we will use Node JS cluster to run Node JS in multiple cores. In this course you will see -
Why Node JS cluster is important?
How to create Node JS cluster application?
Using PM2 to run Node JS application
Communication between Master process and Child Process
Communication between Master process and Child Process using PM2 and RabbitMQ
Working with Redis cache
Using Nginx as a reverse proxy and load balancer
At the end of this course, you will be ready to use Node JS cluster with PM2, RabbitMQ, Redis and Nginx.