{"id":17207364,"url":"https://github.com/abdus/harbor","last_synced_at":"2025-03-25T11:12:48.272Z","repository":{"id":224912021,"uuid":"764571655","full_name":"abdus/harbor","owner":"abdus","description":"Harbor is a load balancer written in Rust","archived":false,"fork":false,"pushed_at":"2024-03-06T05:36:47.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T10:15:31.767Z","etag":null,"topics":["load-balancer","network","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abdus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-02-28T10:20:07.000Z","updated_at":"2024-10-07T12:08:12.000Z","dependencies_parsed_at":"2024-12-03T04:41:32.080Z","dependency_job_id":"49c9f75f-91b4-4976-baae-06a7fed27afb","html_url":"https://github.com/abdus/harbor","commit_stats":null,"previous_names":["abdus/harbor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdus%2Fharbor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdus%2Fharbor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdus%2Fharbor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdus%2Fharbor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abdus","download_url":"https://codeload.github.com/abdus/harbor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245449681,"owners_count":20617190,"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":["load-balancer","network","rust"],"created_at":"2024-10-15T02:45:24.800Z","updated_at":"2025-03-25T11:12:48.232Z","avatar_url":"https://github.com/abdus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# harbor\n\nHarbor is a lightweight load balancer written in Rust. It is fun side-project\nto learn more about networking and load balancing. And also to learn Rust\nbetter. Not intended for production use.\n\nThis project does not use any external libraries for handling HTTP requests. It\nis built from scratch using the `std::net` and `std::thread` modules. I used\n`httparse` for parsing the HTTP requests.\n\n## Roadmap\n\nHere are some of the features that I plan to implement in the future. As of\nnow, I am focusing on the basic features and will add more features as I go\nalong.\n\n- [x] Supports HTTP/1.1\n- [ ] Add support for HTTP/2\n- [ ] Add support for `keep-alive` connections\n- Load balancing algorithms\n  - [x] Round-robin\n  - [ ] Weighted round-robin\n  - [ ] Least Active Connections\n  - [x] Random\n  - [ ] Least Response Time\n  - [ ] IP Hash\n- [ ] Health checks for backend servers\n- [ ] Configuration file support\n- [ ] Logging\n\n## Usage\n\nFirst of all, you will need to have Rust installed on your system. Then you\ncould simply run the `./start.sh` script to start the server. The server will\nstart on `localhost:8080` by default. This will also start a few backend\nservers on `localhost:8081`, `localhost:8082` and `localhost:8083`.\n\nYou can pass a config file. Use environment variable `HARBOR_CONFIG` to specify\nthe path to the config file. You can find an example config in the\n[config.json](./config.json) file.\n\nTo test the load balancer performance (and how it performs under load), you can\nuse the `siege` tool. Here is an example command to test the load balancer:\n\n```sh\nsiege -t1M -c1000 -v http://0.0.0.0:8080\n\n# -t1M: Run the test for 1 minute\n# -c1000: Use 1000 concurrent connections\n# -v: Verbose output\n```\n\nAnd this is how it performed on my machine (Ryzen 5/16GB RAM):\n\n```txt\nLifting the server siege...\nTransactions:\t\t      173012 hits\nAvailability:\t\t      100.00 %\nElapsed time:\t\t       60.58 secs\nData transferred:\t       25.29 MB\nResponse time:\t\t        0.31 secs\nTransaction rate:\t     2855.93 trans/sec\nThroughput:\t\t        0.42 MB/sec\nConcurrency:\t\t      892.15\nSuccessful transactions:      173013\nFailed transactions:\t           0\nLongest transaction:\t       54.73\nShortest transaction:\t        0.00\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE)\nfile for details.\n\nCheck out [Coding Challenges](https://codingchallenges.fyi/challenges/challenge-load-balancer).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdus%2Fharbor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdus%2Fharbor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdus%2Fharbor/lists"}