salvo-rs / salvo

A powerful web framework built with a simplified design.
https://salvo.rs
Apache License 2.0
3.19k stars 187 forks source link

Degraded performance in case of salvo [diesel] #201

Open shujaatak opened 1 year ago

shujaatak commented 1 year ago

While checking out https://www.techempower.com/benchmarks/#section=data-r21 I found that salvo [diesel] lies at 115 position while xitca-web [diesel] lies at awesome 15 position!

image image

I love salvo as I find it easy to use so wondering what degrades the performance in diesel case and if it will be fixed any time soon?

chrislearn commented 1 year ago

You don't need to pay too much attention to the results of this performance test, which has a lot to do with the test code itself. For example, what third-party libraries are used by the test code.

Take the comparison between xitca-web[diesel] and salvo[diesel], xitca-web[diesel] uses diesel-async library, but salvo[diesel] does not use it.

shujaatak commented 1 year ago

Take the comparison between xitca-web[diesel] and salvo[diesel], xitca-web[diesel] uses diesel-async library, but salvo[diesel] does not use it.

Nice analysis!

By the way, it would be great if you could please update the Salvo[Diesel] example so that people looking at techempower benchmarks don't get misled.

Hans-Wu-cn commented 11 months ago

I have also discovered this issue, and I am wondering if it is possible to test the communication capability and memory stability of various web frameworks under the same configuration (without testing the performance of SQL related libraries), as well as the serialization performance

chrislearn commented 11 months ago

In fact, the performance differences between several web frameworks based on hyper are very small. If the performance of a certain test (such as diesel) is low, it is often just a problem with the writing of the test code.

Overall, the performance of salvo is not low, and in some cases the tested performance is even higher than axum.

Although techempower's tests are more authoritative, some frameworks are not maintained in a timely manner and the various dependencies used (rust version, docker image) are inconsistent, which can also lead to performance problems. Typically, the performance of hyper is not as good as axum in many places. This should not be the case.

The performance test is just a reference.