tokio-rs / axum

Ergonomic and modular web framework built with Tokio, Tower, and Hyper
18.69k stars 1.04k forks source link

Why are the plaintext responses so low compared to actix? #1198

Closed ishtms closed 2 years ago

ishtms commented 2 years ago

I saw the results on TFB and I was kinda surprised by how low the plaintext responses were. Any idea?

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", axum was 2x slower than actix-web.

Any reasons/explanations on why would this be an issue?

ishtms commented 2 years ago

Is that because actix's /plaintext query has some really "unrealistic" optimisations done to ramp up the numbers, or is it related to hyper/axum?

davidpdrsn commented 2 years ago

Is that because actix's /plaintext query has some really "unrealistic" optimisations done to ramp up the numbers, or is it related to hyper/axum?

It's because actix-web does unrealistic optimizations in the benchmark.

The tests are performed with rewrk and the most surprising element of the results was when the concurrency was set to "2048", axum was 2x slower than actix-web.

Not sure but you see all frameworks based on hyper exhibit the same behavior in that benchmark. So it's gotta be something with hyper.

Axum doesn't know anything about connections so don't see how it could be something in axum. Consider opening an issue on hyper instead.

ishtms commented 2 years ago

It's because actix-web does unrealistic optimizations in the benchmark.

I see, now. Thanks. I'll raise an issue in Hyper as well.