Replies: 3 comments 7 replies
-
I do not have an explanation, but I'd welcome if you were to investigate :) |
Beta Was this translation helpful? Give feedback.
-
@ishtms wow! Thanks for putting together these benchmark results! The community has really needed something like this. I note that Hyper has higher req/sec than Actix Web with some of the lower concurrency levels. Furthermore, the results with |
Beta Was this translation helpful? Give feedback.
-
@denosaurtrain Thanks for your response. I am testing this on M1 Max mac and this chip really has issues with wrk, rewrk and other benchmarking utilities. If I try to increase threads, the req/s falls down drastically. And if I try to use more than 10 threads, the benchmark doesn't even runs. Some weird issue. On the other hand, these tests run perfectly fine if we set the thread count to default ( If you notice, the Here's the hyper code that's being used use std::convert::Infallible;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response, Server};
async fn hello(_: Request<Body>) -> Result<Response<Body>, Infallible> {
Ok(Response::new("Hello world!".into()))
}
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let make_svc = make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(hello)) });
let port_number: u16 = str::parse(get_port_number().as_str()).unwrap();
let addr = ([127, 0, 0, 1], port_number).into();
let server = Server::bind(&addr).serve(make_svc);
server.await?;
Ok(())
}
fn get_port_number() -> String {
std::env::args().collect::<Vec<String>>()[1].clone()
} |
Beta Was this translation helpful? Give feedback.
-
I saw the results on TFB and I was kinda surprised by how low the plaintext responses were on Hyper based frameworks.
Also, to do some testing, I created a benchmark repo to test all the existing rust web frameworks on a simple "hello world" response text.
You can find the repository with all the results here - Github Link.
The tests are performed with rewrk and the most surprising element of the results was when the concurrency was set to "2048", and all the hyper based frameworks were 2x slower than actix-web.
Any reasons/explanations on why would this be an issue?
Beta Was this translation helpful? Give feedback.
All reactions