Skip to main content

Weighted Round Robin Load Balancer Example

how to setup

  1. install dependecies

npm install

  1. install nginx if it has not been installed

brew install nginx

  1. modify nginx.conf file
    • backup file before making changes
    • location of nginx.conf file for mac is at
    • /usr/local/etc/nginx
  2. run nginx

brew services start nginx

  1. run server 1

PORT=3000 node server.js

  1. run server 2

PORT=3001 node server.js

  1. send request curl localhost:8081/hello a few times to see how the load balancer works