Is hyper Server utilize threads? #3016
-
Greetings! Before tokio, hyper utilized threads: https://docs.rs/hyper/0.9.5/hyper/server/index.html
But what about now? Should I manually spawn a task for every incoming connection to utilize the whole CPU? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
If you're using If you're using The runtime (such as Tokio) will use multiplex the tasks across the amount of threads you've configured it to use (Tokio will use the same amount of threads as CPUs if you didn't specify otherwise). |
Beta Was this translation helpful? Give feedback.
If you're using
hyper::Server
, it will spawn a task for each connection.If you're using
hyper::server::conn::Http
combined with your own socket listener, then you could spawn each HTTP connection into a task.The runtime (such as Tokio) will use multiplex the tasks across the amount of threads you've configured it to use (Tokio will use the same amount of threads as CPUs if you didn't specify otherwise).