{"id":24128212,"url":"https://github.com/kunalvirwal/Velocity","last_synced_at":"2026-06-09T12:31:49.861Z","repository":{"id":257679493,"uuid":"858450639","full_name":"kunalvirwal/Velocity-Load-Balancer","owner":"kunalvirwal","description":"A load balancer with TCP health checks, routing algorithms, and yaml based configuration","archived":false,"fork":false,"pushed_at":"2025-01-01T13:04:35.000Z","size":6010,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T18:45:42.129Z","etag":null,"topics":["go","golang","health-check","least-connections","load-balancer","reverse-proxy","roundrobin","routing","yaml-configuration"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kunalvirwal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-16T23:12:30.000Z","updated_at":"2025-01-10T17:00:42.000Z","dependencies_parsed_at":"2025-01-11T18:40:34.543Z","dependency_job_id":"98a222ca-fa0e-43d3-b5cb-86f1fd2b7382","html_url":"https://github.com/kunalvirwal/Velocity-Load-Balancer","commit_stats":null,"previous_names":["kunalvirwal/velocity-load-balancer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalvirwal%2FVelocity-Load-Balancer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalvirwal%2FVelocity-Load-Balancer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalvirwal%2FVelocity-Load-Balancer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalvirwal%2FVelocity-Load-Balancer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kunalvirwal","download_url":"https://codeload.github.com/kunalvirwal/Velocity-Load-Balancer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241313177,"owners_count":19942417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","health-check","least-connections","load-balancer","reverse-proxy","roundrobin","routing","yaml-configuration"],"created_at":"2025-01-11T18:40:26.804Z","updated_at":"2026-06-09T12:31:49.856Z","avatar_url":"https://github.com/kunalvirwal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n\t\t\t####################################################  \n\t\t\t#\t _   __    __         _ __     \t\t   #  \n\t\t\t#\t| | / /__ / /__  ____(_) /___ __\t   #  \n\t\t\t#\t| |/ / -_) / _ \\/ __/ / __/ // /\t   #  \n\t\t\t#\t|___/\\__/_/\\___/\\__/_/\\__/\\_, /\t\t   #  \n\t\t\t#\t                         /___/ \t\t   #  \n\t\t\t####################################################  \n```\n\n# About\n\nThis is a project to create a load balancer in Golang that can manage local and global servers and containers named Velocity. It should have Round Robin and Least Connections balancing algorithms and should be configurable via yaml.  \nThis project was started in my 3rd semester and is an ambitious and a great learning project.  \nIt currently has Health Checks and removal of servers for if the server is down is configurable via yaml file to route requests to multiple servers for different applications implementing uniquely different balancing algorithms for each one.\n\n# Features of a LoadBalancer:\n\n✅: Implemented  \n🚧: Under active development\n\n✅ It should be software based  \n✅ It should be written in Golang ( use Go routines for parallelism)  \n✅ It should be able to manage all local and global servers and containers  \n✅ Lightweight  \n\n\n## Phase I :Learning Project  \n✅ It should be configurable via a config file :Done  \n✅ It should have:  \n\t1) round robin (normal and weighted) :Done   \n\t2) Least Connections :Done  \n✅ Health Checks for if the server is down add or remove it from rotation [ ✅TCP connections or HTTPS pings or health endpints ] :Done  \n🚧 REST API interface for Hot Addition and removal of servers   \n✅ Proper Logging and monitoring ( access logs like forwards, healthchecks, request drops, status codes,... 🚧can store into a database like a mongo alpine container)  \nRate limiting [ IP address and end point ]  \n\n\n## 🚧Phase II :Prod level orchestration  \nlook up auto scaling  \nIP blacklisting  \nRequest queuing  \nRequest processing time out   \nCircuit breaker   \nExponential backoff  \nIt could also have:  \n\t1) Sticky Round Robin  \n\t2) IP/Url Hash  \n\n## 🚧Phase III :Service level monitoring  \nDashboard for load visualization or can integrate Prometheus  \nReverse proxy Graceful Shutdown  \nTimeouts  \n\n\n\n\n# File structure   \n```\nLoad_Balancer/  \n├── cmd/  \n│   └── main.go                   # Entry point for the application  \n├── internal/  \n│   ├── balancer/  \n│   │   ├── balancer.go           # Core load balancing logic (round robin, least connections, etc.)  \n│   │   ├── round_robin.go        # Different balancing strategies (Round Robin, etc.)  \n│   │   └── least_connections.go  # Different balancing strategies (Least Connections, etc.)  \n│   ├── config/    \n│   │   └── config.go             # Configuration loading and parsing logic  \n│   ├── healthcheck/    \n│   │   └── healthcheck.go        # Health checking logic for backends  \n│   ├── server/  \n│   │   ├── server.go             # Server logic, like adding, removing, and selecting servers  \n│   │   └── baremetal_server.go   # Server handling for bare metal servers  \n│   └── utils/    \n│       ├── utils.go\t\t\t  # Utility functions like Error Handling etc.    \n│       └── logger.go             # Utility functions like logging  \n├── 🚧pkg/    \n│   └── api/    \n│       └── handler.go            # API handler to manage the load balancer (optional)  \n├── test/  \n│   ├── test_servers.go/                    # A go test server that return 200 status code on /.   \n│   ├── sample.env                  # Sample configuration file for the test servers  \n│   └── Dockerfile                          # Dockerfile for the test server  \n├── config.yaml               # Configuration file for backends, strategies, etc.  \n├── go.mod                        # Go module file  \n├── go.sum                        # Go dependencies checksum file  \n└── README.md                     # Project documentation  \n  ```\n  \nTo Run the Load Balancer  \n\n`go run .`  \n  \nFor Hot Realoading while development use:  \n\n`CompileDaemon -build=\"go build -o main .\" -command=\"./main\"`  \n\nFor starting testing server on localhost after creating .env:  \n\n`go run ./test/test_servers.go`  \n  \nFor starting testing server in docker on port 8001:  \n\n`docker run --rm -e PORT=80 -e DURATION=0.1 -p 8001:80 kunalvirwal/go_server`  \n\nFor testing the load balancer use:  \n\n`bombardier -c 125 -n 1000 http://localhost:8000`  \n  \nTip: To test multi-redirection modify your `/etc/hosts` to have many custom domain names to mimic different services and point them all to Velocity port 8000 at localhost  \n\n# Testing and Examples\n\n\u003cp align=center\u003e\nLogging\n\u003c/p\u003e\n\n![Logging](./Readme_Assets/Logging.png)   \n\n\n\u003cp align=center\u003e\nRound Robin Algorithm tests\n\u003c/p\u003e\n\n![Round Robin Algorythm tests](./Readme_Assets/RoundRobin.png)   \n\n\u003cp align=center\u003e  \nLeast Connections Algorithm tests  \n\u003c/p\u003e\n\n![Least Connections Algorithm tests](./Readme_Assets/LeastConnections.png)  \n\n\u003cp align=center\u003e\nMade with ❤️ by Kunal\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalvirwal%2FVelocity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunalvirwal%2FVelocity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalvirwal%2FVelocity/lists"}