This is a simple load balancer app who balance each request to the server running according to algorithm you choice least-connections
or round-robin
. It is implemented using the http-proxy
and http
module of Node.
- Clone the repository
- Navigate to the
02-web_server
directory - Run
yarn install
ornpm install
- In a file
app.ts
change theloadBalancerAlgorithm
toleast-connections
orround-robin
- Run
npx tsc *.ts
to compile the typescript files to javascript - Open 3 terminal windows and run
node server.js
,node app.js
&./test_load_balancing
in each of them
- Lanch the test script
./test_load_balancing
in a terminal