A lightweight and efficient load balancer implemented in Rust.
This project is a load balancer built using the Rust programming language and the Axum web framework. It is designed to be efficient and lightweight, capable of distributing incoming HTTP requests across multiple backend servers.
- Efficiently handles incoming HTTP requests and routes them to backend servers.
- Logs incoming requests and responses for easy debugging and monitoring.
- Configurable logging levels to control the amount of logged information.
- Utilizes the
reqwest
library for making HTTP requests to backend servers. - Thread-safe, using
tokio::sync::Mutex
for state management.
- Rust (latest stable version recommended)
- Cargo (Rust package manager)
- Git
or
- Docker
docker run -p 9999:9999 -v $(pwd)/ferrugem.toml:/usr/local/bin/ferrugem.toml erickcestari/ferrugem
-
Clone the repository:
git clone https://github.com/erickcestari/ferrugem.git cd rust-load-balancer
-
Build the project:
cargo build --release
-
Run the load balancer:
cargo run --release
The load balancer can be configured using a ferrugem.toml
struct. Below is an example configuration:
port = 9999
log_level = 'info'
algorithm = 'round-robin'
[[servers]]
name = "api1"
url = "https://jsonplaceholder.typicode.com"
[[servers]]
name = "api2"
url = "https://jsonplaceholder.typicode.com"
Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.
This project is licensed under the MIT License.