Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lb-go

A simple Load Balancer implementation in Go, built from scratch to understand the core concepts behind load balancing and TCP proxying.

Current Features

  • TCP Load Balancer
  • Round Robin
  • Weighted Round Robin
  • Least Connections
  • Multiple backend servers
  • Concurrent client connections
  • Bidirectional TCP forwarding
  • Basic backend health state

Architecture

Client
   |
   v
Load Balancer :9090
   |
   +---- Backend 1 :8081
   |
   +---- Backend 2 :8082
   |
   +---- Backend 3 :8083

The load balancer accepts client connections, selects a backend using the configured strategy, and forwards traffic between the client and backend.

Load Balancing Strategies

Currently implemented:

  • Round Robin
  • Weighted Round Robin
  • Least Connections

Planned:

  • Consistent Hashing
  • Health Checks / Backend Failure Detection
  • Graceful Backend Recovery

Goal

This project is primarily a learning project to understand how load balancers work internally, including:

  • Scheduling algorithms
  • TCP connections and streams
  • Concurrent connections
  • Goroutines and synchronization
  • Backend health
  • Connection lifecycle
  • Consistent hashing

Built from scratch in Go.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages