Skip to content

leonardo5621/golang-load-balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang Load Balancer

Project of a Load Balancer in Golang

A load balancer is a device responsible for distributing network traffic among a certain number of servers. Its a fundamental piece to increase reliability and robustness of modern applications

The concept behind this project consists of a basic load balancer written in Golang.

The input is given through a configuration file refered to as config.yaml, example of a configuration file down below:

## Load Balancer Port
lb_port: 3333
## Retry limit of a backend server 
retry_limit: 3
## Backend servers host
backends:
  - "http://localhost:100"
  - "http://localhost:101"

This load balancer supports two strategies:

  • Round Robin: this algorithm equally distributes incoming traffic among the available servers
  • Least Connections: traffic is distributed taking into account the number of active connections in each server

The strategy con be specified in the configuration file:

lb_port: 3333
## LB strategy (uses round-robin as default)
strategy: least-connection
retry_limit: 3
backends:
  - "http://localhost:100"
  - "http://localhost:101"

References

About

Project of a simple Load Balancer in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages