Skip to content

carantes/go-load-balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Load Balancer

This is my own implementation of an Round-Robin API Load Balancer in Go using concurrent programming and synchronization techniques. Coding Challenges series by John Crickett https://codingchallenges.fyi/challenges/challenge-load-balancer/

  • Active and Passive Healthchecks
  • Healthcheck url on servers with checks dependent resources (Redis, DB, etc)
  • Round-Robin requests to all active servers

TODO:

  • Different algorithms: Round-Robin, Least-Connections (TODO)
  • Retry & Timeout mechanism (TODO)
  • Self register new servers to the LB pool

Requirements

Setup

make build
make install

Run

Servers

Start two or more servers using different ports

golb --type node --addr :8081
golb --type node --addr :8082

Load Balancer

Start the Load Balancer and the urls of the existing servers

golb --type lb --addr :8080 --urls http://localhost:8081,http://localhost:8082

Tests

curl --parallel --parallel-immediate --parallel-max 4 --config urls.txt

About

API Load balancer with passive and active healthchecks, concurrent go routines and synchronization strategies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published