Profiler is an asynchronous web server profiling library that supports concurrent requests.
Benchmarks the following metrics when talking to a web server:
- DNS resolution (Uses tokio::net::lookup_host)
- TCP connection (Uses tokio::net::TcpStream)
- TLS connection (Uses tokio_native_tls::TlsConnector)
- First byte received (Tracks bytes received on tokio_native_tls::TlsStream)
- Total response time (Sums all elapsed times)
use profiler;
#[tokio::main]
async fn main() {
let domain = "google.com";
let concurrency = 3;
match profiler::benchmark(&domain, concurrency).await {
Ok(benchmarks) => println!("{:?}", benchmarks),
Err(e) => panic!("Failed to profile webserver {}", e),
}
}