Code Monkey home page Code Monkey logo

load-balancer's Introduction

Load Balancer

A Load balancer which distributes requests to many servers, implemented from scratch in go lang.

Features

  • Static load Balacing: Acheived using Round robin assumes optimistic requests completion.

  • Periodic Health Checks: Hits health check end points after a specific timeout can be tuned according to use case.

  • Active Passive Server Management: Requests wont be redirected to failing servers or servers that are shutdown.

API Reference

Loadbalancer

GET /

Redirects the request to server according to algorithmn, copies the response and sends back to client.

Servers

Default endpoint

  GET /

Returns the message from servers. For easier identification I explicitly specified Server Id.

Healthcheck endpoint

  GET /healthcheck

Returns health message with 200 status code.

Run Locally

Clone the project

  git clone https://github.com/adityadafe/load-balancer

Go to the server directory

  cd server

Run server

  go run .

Go to loadbal directory

  cd loadbal

Run loadbalancer

  go run .

Benefits

  • Improved Availability: Distributes incoming traffic across multiple servers to ensure no single server becomes a bottleneck, enhancing overall system uptime.
  • Scalability: Easily scales application infrastructure by adding or removing servers as demand changes, ensuring consistent performance.
  • Enhanced Performance: Balances the load to prevent any single server from being overwhelmed, improving response times and throughput.
  • Fault Tolerance: Automatically detects server failures and reroutes traffic to healthy servers, maintaining service continuity.
  • Efficient Resource Utilization: Maximizes the utilization of available server resources, reducing idle time and optimizing cost-efficiency.
  • Security: Provides an additional layer of security by masking the backend server infrastructure, and can also help mitigate DDoS attacks.
  • Simplified Maintenance: Allows for maintenance or upgrades on individual servers without disrupting the overall service, ensuring continuous availability.
  • Geographic Distribution: Directs traffic to servers located closest to the user, reducing latency and improving user experience.

Caution

This is not recommended to put in production enviornment use battle tested lb like fabio

Future Work

I have created branches with different versions and implementation. In coming time i will add registry endpoint for service registry.

load-balancer's People

Contributors

adityadafe avatar

Stargazers

Vedant Zope avatar Yadhnesh vyawahare avatar Chirag Bablani avatar Ayomide Micheal avatar Sahil avatar Neutron avatar  avatar ashish avatar Om Tajne avatar mlutfi avatar srinivasa reddy challa avatar Ameya Shrivastava avatar Nick C. avatar Om Thakare avatar  avatar Sadman Sakib avatar Sayan De avatar Anurag avatar Ronit Raj avatar  avatar Junaid avatar HARSH VARDHAN SINGH avatar Neeraj Ramola avatar Kartikey Shahi avatar Prajwal Hallale avatar Pratyush Pahari avatar Rajneel Anuraj avatar Akash Goswami avatar CodeTorso avatar Chinmay Sawant  avatar piyush avatar Ayush avatar rds_agi avatar Kamesh Goundhare avatar Kunal Verma avatar aryan bramhane avatar Purusha avatar Atharva Pardeshi avatar  avatar revat avatar

Watchers

 avatar

Forkers

asmraihan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.