Skip to content

MongoExpUser/Nodejs-Load-Balancer-On-EC2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nodejs-Load-Balancer-On-EC2

Load Balancing of Web or Application Servers with a NodeJS load balancer (lb) application.

Architectural Diagram

Image description

Purpose

  • Load Balancing of Web or Application Servers on AWS EC2 machine.
  • The current demonstration is for an AWS EC2 instance but the NodeJS application can be run on any cloud provider VM e.g (Linode, GCP, Azure, OCI, DO, etc.) as long as the network is properly set up.

Advantages

  • Fast.
  • Cheaper.
  • Easy to deploy.
  • Load requests across multiple machines globally.

Install Dependency

Run App

  • To run the load balancing app:
    • Download the following source files in this repository:
      • appLB.js
      • common.js
      • config.json
    • Edit relevant input variables within the config.json file, as deem necessary.
    • Upload the source files to the same folder on an AWS EC2 machine.
    • Then, run the appLB.js script from within the folder as:
      sudo node --inspect=$((9233 + $RANDOM % 100)) --trace-warnings --trace-deprecation --watch appLB.js

License

Copyright © 2023. MongoExpUser

Releases

No releases published

Packages

No packages published