19 releases

new 0.3.2 Nov 24, 2024
0.3.1 Nov 20, 2024
0.2.3 Nov 3, 2024
0.2.1 Oct 31, 2024
0.1.11 Oct 26, 2024

#188 in HTTP server

Download history 335/week @ 2024-09-29 598/week @ 2024-10-06 236/week @ 2024-10-13 81/week @ 2024-10-20 383/week @ 2024-10-27 153/week @ 2024-11-03 4/week @ 2024-11-10 242/week @ 2024-11-17

860 downloads per month

MIT license

98KB
2K SLoC

Volga

Fast, Easy, and very flexible Web Framework for Rust based on Tokio runtime and hyper for fun and painless microservices crafting.

latest latest License: MIT Build Release

Tutorial | API Docs | Examples

Features

  • Supports HTTP/1 and HTTP/2
  • Robust routing
  • Custom middlewares
  • Full Tokio compatibility
  • Runs on stable Rust 1.80+

Getting Started

Dependencies

[dependencies]
volga = "0.3.2"
tokio = "1.41.1"

Simple asynchronous request handler:

use volga::*;

#[tokio::main]
async fn main() -> std::io::Result<()> {
    // Start the server
    let mut app = App::build("127.0.0.1:7878").await?;

    // Example of asynchronous request handler
    app.map_get("/hello/{name}", |req| async move {
        let name: String = req.param("name")?;
        ok!("Hello {}!", name)
    });
    
    app.run().await
}

Performance

Tested a single instance on a laptop using 1 thread and 200 connections and under configuration:

OS: Arch Linux
CPU: Intel i7-8665U (8) @ 4.800GHz
RAM: 31686MiB

Results

Running 10s test @ http://127.0.0.1:7878/hello
  1 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   578.90us  206.77us   5.77ms   79.81%
    Req/Sec   184.72k     9.54k  200.74k    77.00%
  1837693 requests in 10.08s, 206.80MB read
Requests/sec: 182380.80
Transfer/sec:     20.52MB

Dependencies

~5–14MB
~170K SLoC