Skip to content

LukaMatcharashvili/Load-Balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

This is a toy project for educational purposes only. It is not intended for production use.

How to run locally

Install dependencies for the example server

cd example
npm install
cd ..

Install dependencies for the LB

cd LB
go tidy
cd ..

Run the example server twice

cd example

export PORT=3000
node index.js

export PORT=3001
node index.js

Run the LB

cd LB
export TARGET_URLS=http://localhost:3000,http://localhost:3001
cd cmd/lb
go run .

Test the LB

Send a request to the LB (http://localhost:3002) You can check the logs of the example servers to see the requests being routed to the different servers

Docker

Pull the image

docker pull lukamacharashvili/my-load-balancer:latest

Run the image

docker run --network="host" -e TARGET_URLS=http://localhost:3000,http://localhost:3001 lukamacharashvili/my-load-balancer:latest

Test the LB

Send a request to the LB (http://localhost:3002) You can check the logs of the example servers to see the requests being routed to the different servers

About

Load Balancer created with Golang using Round Robin algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published