salvo icon indicating copy to clipboard operation
salvo copied to clipboard

How to specify the sarting thread count ?

Open toplinuxsir opened this issue 3 years ago • 1 comments

How to specify the sarting thread count ?

toplinuxsir avatar Oct 19 '22 04:10 toplinuxsir

you can use #[tokio::main(flavor = "multi_thread", worker_threads = 10)] to specify tokio runtime worker thread

or, you can use tokio + hyper to Build your own runtime configuration like this

https://github.com/salvo-rs/salvo/blob/9c4b63fb1c93f08d622787acf4c142dd74fce2f4/crates/core/src/server.rs#L55

driftluo avatar Oct 19 '22 05:10 driftluo

@driftluo Thanks how to dynamicly specify the thread count ?

toplinuxsir avatar Oct 21 '22 06:10 toplinuxsir

The worker_threads option configures the number of worker threads, and defaults to the number of cpus on the system.

If you want to change it during runtime, that is an unsupported feature

driftluo avatar Oct 26 '22 09:10 driftluo