Building a Simple HTTP Server
Learn how to benchmark a simple HTTP server that uses the cluster module and provides auto restarting of failed workers.
Creating an HTTP server using the cluster
module
Let’s now start working on an example. Let’s build a small HTTP server, cloned and load balanced using the cluster
module. First of all, we need an application to scale, and for this example, we don’t need too much, just a very basic HTTP server.
So, let’s create a file called app.js
containing the following code:
Get hands-on with 1400+ tech skills courses.