| Principles for Fast Tokio Applications(dial9-rs.github.io) | |
| 241 points by carllerche 1 day ago | 62 comments | |
tl;dr: Writing performant Tokio applications requires balancing fairness (yielding frequently for latency) against batching (amortizing overhead for throughput), while avoiding pitfalls like contended mutexes that can stall all workers, global resource bottlenecks (blocking pool, global queue), and OS scheduling delays from noisy neighbor threads. The author recommends starting from real metrics rather than chasing red flags, constraining parallelism with semaphores, and isolating latency-sensitive work on separate runtimes pinned to dedicated cores. Advanced tactics like blocking the executor or spinning can be appropriate in specific controlled scenarios but shouldn't be defaults. | |
HN Discussion:
| |