Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no benchmark Compared to tokio and async_std? #210

Open
zhuxiujia opened this issue Oct 21, 2020 · 5 comments
Open

There is no benchmark Compared to tokio and async_std? #210

zhuxiujia opened this issue Oct 21, 2020 · 5 comments

Comments

@zhuxiujia
Copy link

There is no benchmark Compared to tokio and async_std?

@notgull
Copy link
Member

notgull commented Nov 26, 2023

Benchmarking async runtimes is really hard. The potential workloads are so diverse that, at a point, it doesn't really matter.

As a general rule, there are two main bottlenecks in an async runtime: the reactor and the executor. async-std and smol use the same executor. tokio's executor is probably faster for longer term workloads (like if a network connection slowly dispatches packets of bytes over a long period of time), while smol's is better for shorter term workloads (like all the bytes being immediately available from a socket).

smol's reference executor is almost certainly slower than tokio's executor. But it's easy to slot another executor in (like smolscale).

These are just qualitative estimates based on the architectures of the runtimes. If the tokio team would like to collaborate on a more quantitative set of benchmarks I would be happy to oblige.

@varbhat
Copy link

varbhat commented Feb 1, 2024

IMG_20240201_131427_828

I benchmarked axum powered by tokio vs axum powered by smol. wrk tool was used to benchmark both.

The top section of the image is benchmark of axum powered by tokio. The bottom section of the image is benchmark of axum powered by smol.

The axum endpoint just returns static string "Hello world". It's just homepage example of axum.

CC: @notgull

TLDR:
axum powered by tokio =>
Reqs/sec : 79.1k
Transfer/sec: 98.1MB

axum powered by smol =>
Reqs/sec: 67.5k
Transfer/sec: 83.6MB

@zhuxiujia
Copy link
Author

IMG_20240201_131427_828

I benchmarked axum powered by tokio vs axum powered by smol. wrk tool was used to benchmark both.

The top section of the image is benchmark of axum powered by tokio. The bottom section of the image is benchmark of axum powered by smol.

The axum endpoint just returns static string "Hello world". It's just homepage example of axum.

CC: @notgull

TLDR: axum powered by tokio => Reqs/sec : 79.1k Transfer/sec: 98.1MB

axum powered by smol => Reqs/sec: 67.5k Transfer/sec: 83.6MB

This doesn't seem as good as Tokio

@notgull
Copy link
Member

notgull commented Feb 2, 2024

The default executor for smol is quite slow. smolscale probably has better performance characteristics.

@sirius-cc-wu
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants