Deston is an advanced Layer 4 (L4) and Layer 7 (L7) load balancer built with Rust. It provides robust performance, scalability, and fine-grained control for managing high-volume traffic across backend server infrastructures.
- Dual support for L4 and L7 load balancing.
- Modular Design: Clean separation of concerns using Rust modules (
config,server,load_balancer). - Highly Scalable: Built with
tokiofor asynchronous, non-blocking server connections. - Pluggable Algorithms:
- Round Robin
- Weighted Round Robin
- IP Hashing
- Smart Server Health Checks: Tracks response time, active connections, etc.
- Customizable:
- Easy configuration through
config.toml. - Supports dynamic addition of backend servers.
- Easy configuration through
flowchart TD
Client(Client Requests)
subgraph Deston Load Balancer
L7[Layer 7 Load Balancer<br>HTTP/HTTPS]
L4[Layer 4 Load Balancer<br>TCP/UDP Streams]
end
Backend[Backend Servers]
Client ==> L7
L7 --> L4
L4 --> Backend
- Accepts client requests, either HTTP (Layer 7) or generic TCP/UDP streams (Layer 4).
- Forwards the traffic to backend servers after running load-balancing algorithms.
- Continuously monitors backend server health and adjusts routing dynamically.
- Rust 1.70+ (Install from rustup)
- Ensure
cargois available for building and running.
cargo build --releasecargo run --releaseModify config.toml to add servers, specify load-balancing algorithms, etc.:
[load_balancer]
address = "127.0.0.1"
port = 8080
algorithm = "RoundRobin"
[[server]]
address = "http://127.0.0.1:3000"
port = 3000
[[server]]
address = "http://127.0.0.1:3001"
port = 3001Here is a glimpse of some of Deston's key components:
pub struct Layer4 {
config: SyncConfig,
}
impl load_balancer::LoadBalancer for Layer4 {
async fn start(&self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let lb_address = "http://127.0.0.1:8000".parse::<Uri>().unwrap();
let listener = TcpListener::bind((host, port)).await?;
loop {
let (stream, addr) = listener.accept().await?;
tokio::task::spawn(async move { ... });
}
}
}Deston warmly welcomes contributors! π
- To get involved, see
CONTRIBUTING.md(if available). - Report issues or suggest new features via GitHub Issues.
This repository is licensed under the MIT License. See the LICENSE file for more details.
Built using:
Deston is an advanced Layer 4 (L4) and Layer 7 (L7) load balancer built with Rust. It provides robust performance, scalability, and fine-grained control for managing high-volume traffic across backend server infrastructures.
- Dual support for L4 and L7 load balancing.
- Modular Design: Clean separation of concerns using Rust modules (
config,server,load_balancer). - Highly Scalable: Built with
tokiofor asynchronous, non-blocking server connections. - Pluggable Algorithms:
- Round Robin
- Weighted Round Robin
- IP Hashing
- Smart Server Health Checks: Tracks response time, active connections, etc.
- Customizable:
- Easy configuration through
config.toml. - Supports dynamic addition of backend servers.
- Easy configuration through
flowchart TD
Client(Client Requests)
subgraph Deston Load Balancer
L7[Layer 7 Load Balancer<br>HTTP/HTTPS]
L4[Layer 4 Load Balancer<br>TCP/UDP Streams]
end
Backend[Backend Servers]
Client ==> L7
L7 --> L4
L4 --> Backend
- Accepts client requests, either HTTP (Layer 7) or generic TCP/UDP streams (Layer 4).
- Forwards the traffic to backend servers after running load-balancing algorithms.
- Continuously monitors backend server health and adjusts routing dynamically.
- Rust 1.70+ (Install from rustup)
- Ensure
cargois available for building and running.
cargo build --releasecargo run --releaseModify config.toml to add servers, specify load-balancing algorithms, etc.:
[load_balancer]
address = "127.0.0.1"
port = 8080
algorithm = "RoundRobin"
[[server]]
address = "http://127.0.0.1:3000"
port = 3000
[[server]]
address = "http://127.0.0.1:3001"
port = 3001Here is a glimpse of some of Deston's key components:
pub struct Layer4 {
config: SyncConfig,
}
impl load_balancer::LoadBalancer for Layer4 {
async fn start(&self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let lb_address = "http://127.0.0.1:8000".parse::<Uri>().unwrap();
let listener = TcpListener::bind((host, port)).await?;
loop {
let (stream, addr) = listener.accept().await?;
tokio::task::spawn(async move { ... });
}
}
}Deston warmly welcomes contributors! π
- To get involved, see
CONTRIBUTING.md(if available). - Report issues or suggest new features via GitHub Issues.
This repository is licensed under the MIT License. See the LICENSE file for more details.
Built using: