{"id":26189931,"url":"https://github.com/paahaad/load-balancer-rust","last_synced_at":"2026-04-22T00:31:40.223Z","repository":{"id":274787250,"uuid":"924068517","full_name":"paahaad/Load-Balancer-Rust","owner":"paahaad","description":"Simple Load balancer using the rust pingora framework.","archived":false,"fork":false,"pushed_at":"2025-01-29T11:32:10.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T09:56:18.946Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/paahaad.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":"2025-01-29T11:06:48.000Z","updated_at":"2025-06-23T05:23:53.000Z","dependencies_parsed_at":"2025-01-29T14:15:36.634Z","dependency_job_id":null,"html_url":"https://github.com/paahaad/Load-Balancer-Rust","commit_stats":null,"previous_names":["paahaad/load-balancer-rust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paahaad/Load-Balancer-Rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paahaad%2FLoad-Balancer-Rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paahaad%2FLoad-Balancer-Rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paahaad%2FLoad-Balancer-Rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paahaad%2FLoad-Balancer-Rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paahaad","download_url":"https://codeload.github.com/paahaad/Load-Balancer-Rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paahaad%2FLoad-Balancer-Rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32115773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"ssl_error","status_checked_at":"2026-04-22T00:30:22.894Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-03-12T00:51:52.554Z","updated_at":"2026-04-22T00:31:40.194Z","avatar_url":"https://github.com/paahaad.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pingora Load Balancer\n\nA simple load balancer built using [Pingora](https://github.com/cloudflare/pingora), a Rust-based framework for building high-performance proxies and load balancers. This project demonstrates how to set up a basic load balancer that distributes traffic across multiple backend servers.\n\n---\n\n## Features\n\n- **Round Robin Load Balancing**: Distributes requests evenly across backend servers.\n- **Health Checks**: Ensures traffic is only routed to healthy upstream servers.\n- **Customizable**: Easily extendable to support more advanced load balancing strategies.\n\n---\n\n## Prerequisites\n\nBefore running the project, ensure you have the following installed:\n\n1. **Rust**: Install Rust from [rustup.rs](https://rustup.rs/).\n2. **Backend Servers**: Two or more HTTP servers to act as upstream servers (e.g., Express.js servers).\n\n---\n\n## Setup\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/your-username/pingora-lb.git\ncd pingora-lb\n```\n\n### 2. Build the Project\n```bash\ncargo build --release\n```\n\n### 3. Set Up Backend Servers\nRun two or more HTTP servers on different ports. For example, using Express.js:\n\n```javascript\n// server.mjs\nimport express from \"express\";\n\nconst app = express();\nconst PORT = 3000; // Change this for each server\n\napp.get(\"/\", (_, res) =\u003e res.end(`Hello from server on port ${PORT}`));\n\napp.listen(PORT, () =\u003e console.log(`Server running on port ${PORT}`));\n```\n\nStart the servers:\n```bash\nnode server.mjs  # On port 3000\nnode server.mjs  # On port 3001\n```\n\n### 4. Configure the Load Balancer\nUpdate the `main.rs` file to point to your backend servers:\n```rust\nlet upstreams =\n    Arc::new(LoadBalancer::try_from_iter([\"127.0.0.1:3000\", \"127.0.0.1:3001\"]).unwrap());\n```\n\n### 5. Run the Load Balancer\n```bash\ncargo run\n```\n\nThe load balancer will start on `0.0.0.0:6789`.\n\n---\n\n## Usage\n\n### Test the Load Balancer\nSend a request to the load balancer:\n```bash\ncurl http://localhost:6789\n```\n\nYou should see responses alternating between your backend servers:\n```\nHello from server on port 3000\nHello from server on port 3001\n```\n\n### Health Checks\nThe load balancer periodically checks the health of the upstream servers. Unhealthy servers are automatically removed from the pool.\n\n---\n\n## Configuration\n\n### Upstream Servers\nEdit the `upstreams` array in `main.rs` to add or remove backend servers:\n```rust\nlet upstreams =\n    Arc::new(LoadBalancer::try_from_iter([\"127.0.0.1:3000\", \"127.0.0.1:3001\", \"127.0.0.1:3002\"]).unwrap());\n```\n\n### Load Balancing Strategy\nBy default, the load balancer uses **Round Robin**. You can implement other strategies by modifying the `selection` module.\n\n---\n\n## Logs\nThe load balancer logs incoming requests and upstream server health checks. Check the logs for debugging:\n```bash\ntail -f pingora-lb.log\n```\n\n---\n\n## Questions?\nIf you have any questions or need help, feel free to open an issue or contact the parvat.raj2@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaahaad%2Fload-balancer-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaahaad%2Fload-balancer-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaahaad%2Fload-balancer-rust/lists"}