Closed mingfukuang closed 3 months ago
@mingfukuang If I understand this right, Tokio already supports this out of the box via TOKIO_WORKER_THREADS
env variable.
The core threads are where all asynchronous code runs, and Tokio will by default spawn one for each CPU core. You can use the environment variable TOKIO_WORKER_THREADS to override the default value.
See https://docs.rs/tokio/latest/tokio/#cpu-bound-tasks-and-blocking-code and https://github.com/tokio-rs/tokio/pull/4250
Going to close this one, let me know if I missed anything.
@mxpv I learned and agreed , thank for your explanation.
The current shim process can run on all cores in the system, which is not suitable for scenarios with high CPU load. Add a shim thread count setting for runtime, the number of shim worker threads can be controlled through environment variables.