Skip to content

Yummy-Yums/load-balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Load Balancer

A high-performance, scalable load balancer built with modern distributed systems principles

Scala ZIO License Ask DeepWiki

✨ Features

  • 🔄 Multiple Load Balancing Algorithms

    • Round Robin
    • Weighted Round Robin
    • Least Connections
    • IP Hash
    • Health Check-based routing
  • ⚡ High Performance

    • Async/non-blocking I/O with ZIO
    • Efficient connection pooling
    • Minimal latency overhead
  • 🔧 Configuration-Driven

    • YAML/JSON configuration
    • Environment-based configs
  • link to demo Demo

🚀 Quick Start

Prerequisites

  • Java 11+
  • SBT 1.x
  • Docker (optional)

Installation

git clone https://github.com/Yummy-Yums/load-balancer.git
cd load-balancer
sbt compile

Configuration

Create a application.conf file:

Application {
    port = 8080
    host = "localhost"
    backends=[
    "http://127.0.0.1:8081",
    "http://127.0.0.1:8082",
    "http://127.0.0.1:8083"
    ]
    health-check-interval = 3
}

🔧 Load Balancing Strategies

Round Robin

Distributes requests evenly across all healthy backends.

LoadBalancer.roundRobin(backends)

Health Checks

Access health status at /health:

curl http://localhost:8080/health

🧪 Testing

Unit Tests

sbt test

🛠️ Development

Project Structure

├── build.sbt
├── lb
├── lb.jar
├── project
│   ├── build.properties
│   ├── metals.sbt
│   ├── plugins.sbt
│   ├── project
│   └── target
├── readme.md
├── src
│   ├── main
│   └── test

Key Dependencies

libraryDependencies ++= Seq(
  "dev.zio" %% "zio" % "2.0.21",
  "dev.zio" %% "zio-http" % "3.0.0-RC4",
  "dev.zio" %% "zio-config" % "4.0.0-RC16",
  "dev.zio" %% "zio-json" % "0.6.2",
  "dev.zio" %% "zio-metrics-prometheus" % "2.0.8",
  "dev.zio" %% "zio-logging" % "2.1.16"
)

📚 Documentation

Code Style

We use Scalafmt for code formatting:

sbt scalafmt

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published