Skip to content

A Lightweight, go-based Load Balancer with Active-Passive Server Management and Periodic Health Checks.

Notifications You must be signed in to change notification settings

manthanguptaa/load-balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Load Balancer

1_.Screen.Recording.2024-01-22.at.6.48.32.PM.mp4

A Lightweight, go-based Load Balancer with Active-Passive Server Management and Periodic Health Checks.

This project implements a simple load balancer in Golang that distributes incoming requests amongst a pool of backend servers while monitoring their health. It features:

  • Round-robin load balancing: Requests are evenly distributed across available servers.
  • Active-passive server management: Only healthy servers receive requests. Unhealthy servers are automatically disabled until they recover.
  • Periodic health checks: Each server undergoes regular health checks to assess its status.

Benefits:

  • Improved system resilience: By distributing traffic across multiple servers, your application becomes more resistant to individual server failures.
  • Enhanced scalability: Easily handle increased traffic by adding more backend servers to the pool.
  • Simplified server management: Automatic health checks and active-passive server management remove the need for manual intervention.

Getting Started:

  1. Requirements: Golang 1.17+

  2. Clone Repository:

    $ git clone https://github.com/manthanguptaa/load-balancer.git
  3. Setup backend server

    $ cd be
    $ go run .
  4. Setup load balancer

    $ cd lb
    $ go run .
  5. Configure Backend Servers:

    • Update the list of backend servers in the lb/main.go file.
    • Each server should be represented as a server struct with its URL and initial is_active state.

Health Check Endpoint:

The mock backend server exposes a /healthcheck endpoint. You can customize this endpoint to perform specific health checks for your application requirements.

Disclaimer:

This is a simple example of a load balancer and may not be suitable for production environments with high-performance requirements. Consider your specific needs and adapt the code accordingly.

About

A Lightweight, go-based Load Balancer with Active-Passive Server Management and Periodic Health Checks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages