Multiple event loops / reactors with threadpool

High I/O systems usually spawn multiple event loops / reactors, e.g. one event loop / reactor per CPU core, and run these on the same fd / socket.

How to achieve it in rust with tokio / mio? Links with examples are appreciated.

Thanks.

You can spawn multiple current_thread Tokio runtimes. This is what actix_web does.

1 Like

thanks for the suggestion, so current_thread Tokio runtime is single event loop with executor OS thread pool?

I am trying to get the highest theoretical throughput on I/O bound tasks, not sure which model is better,
single event loop with executor OS thread pool or multiple event loops, each running together with an executor on its own OS thread?

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.