Skip to content

βš–οΈ A simple, efficient load balancer implemented in Go πŸš€

License

Notifications You must be signed in to change notification settings

mutasim77/load-balancer-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Projects Banner

A simple, powerful, and extensible load balancer written in Go!

🌟 Introduction

Welcome to the Go Load Balancer project! This load balancer efficiently distributes incoming network traffic across multiple backend servers, ensuring no single server bears too much load. It's perfect for improving the reliability and scalability of your web applications.

πŸ€” What is a Load Balancer?

A load balancer acts as a traffic cop for your web applications. It:

  • Distributes client requests across multiple servers
  • Ensures high availability and reliability by sending requests only to online servers
  • Provides the flexibility to add or subtract servers as demand dictates

load-balancer

πŸ”„ About Round Robin Algorithm

This project implements the Round Robin algorithm for load balancing. Here's how it works:

  1. Imagine your servers lined up in a circle
  2. For each new request, the load balancer picks the next server in line
  3. When it reaches the last server, it starts over from the beginning

It's simple, fair, and effective for many use cases!

βš™οΈ How It Works

  1. The load balancer receives incoming requests
  2. It checks the health of all backend servers
  3. Using the Round Robin algorithm, it selects a healthy server
  4. The request is forwarded to the chosen server
  5. The server's response is returned to the client

🎯 Features

  • ✨ Simple Round Robin load balancing
  • πŸ₯ Health checks for backend servers
  • πŸ”„ Automatic removal of unhealthy servers
  • 🚦 Concurrent request handling
  • πŸ”§ Easy to extend with new balancing strategies

πŸ“Š Usage

This project uses a Makefile for easy building and running. Here are the main commands:

# Build the project
make build

# Run the load balancer
make run-load-balancer

# Run backend servers
make run-backends

# Run a test
make test

# Stop backend servers
make stop-backends

# Clean up
make clean

πŸš€ Getting Started

  1. Clone this repository
  2. Run make build to compile the load balancer and backend servers
  3. Start the backend servers with make run-backends
  4. In a new terminal, start the load balancer with make run-load-balancer
  5. Test it out with make test

🀝 Contributing

Contributions are welcome! Feel free to submit a Pull Request.

πŸ“œ License

This project is licensed under the MIT License

Happy load balancing! πŸŽ‰

About

βš–οΈ A simple, efficient load balancer implemented in Go πŸš€

Topics

Resources

License

Stars

Watchers

Forks