| ▲ | DarmokTanagra 15 hours ago | |
Thank you for a complete answer. Out of curiosity where do you stand on libraries like this imposing a runtime choice on the user? Is it standard in the rust ecosystem to have multiple async runtimes in a project? | ||
| ▲ | vlovich123 14 hours ago | parent [-] | |
It’s fine to have multiple runtimes. There’s probably some additional performance overhead at the API boundary because you have to transfer the work to run on the other runtime but I haven’t benchmarked what that looks like. It’s probably on the order of 50ns-1us if done naiively and depending on contention (ie you’re looking at a max throughput of 20M-1M/s). Use whatever you want. Tokio is a very good work stealing runtime which is what Apple’s GCD popularized 17 years ago. It’s a fine model but sacrifices total throughput for ease of use and “easy” multithreading. Thread per core with pinned cores is what you use when you prioritize throughput and absolute possible latency. Tail latencies can suffer if you make a mistake and have imbalanced work on a single thread | ||