|
13 | 13 | //! not required to configure a [`Runtime`] manually, and a user may just use the
|
14 | 14 | //! [`tokio::main`] attribute macro, which creates a [`Runtime`] under the hood.
|
15 | 15 | //!
|
| 16 | +//! # Choose your runtime |
| 17 | +//! |
| 18 | +//! Here is the rules of thumb to choose the right runtime for your application. |
| 19 | +//! |
| 20 | +//! ```plaintext |
| 21 | +//! +------------------------------------------------------+ |
| 22 | +//! | Do you want work-stealing or multi-thread scheduler? | |
| 23 | +//! +------------------------------------------------------+ |
| 24 | +//! | Yes | No |
| 25 | +//! | | |
| 26 | +//! | | |
| 27 | +//! v | |
| 28 | +//! +------------------------+ | |
| 29 | +//! | Multi-threaded Runtime | | |
| 30 | +//! +------------------------+ | |
| 31 | +//! | |
| 32 | +//! V |
| 33 | +//! +--------------------------------+ |
| 34 | +//! | Do you execute `!Send` Future? | |
| 35 | +//! +--------------------------------+ |
| 36 | +//! | Yes | No |
| 37 | +//! | | |
| 38 | +//! V | |
| 39 | +//! +--------------------------+ | |
| 40 | +//! | Local Runtime (unstable) | | |
| 41 | +//! +--------------------------+ | |
| 42 | +//! | |
| 43 | +//! v |
| 44 | +//! +------------------------+ |
| 45 | +//! | Current-thread Runtime | |
| 46 | +//! +------------------------+ |
| 47 | +//! ``` |
| 48 | +//! |
| 49 | +//! The above decision tree is not exhaustive. there are other factors that |
| 50 | +//! may influence your decision. |
| 51 | +//! |
| 52 | +//! ## Bridging with sync code |
| 53 | +//! |
| 54 | +//! See <https://tokio.rs/tokio/topics/bridging> for details. |
| 55 | +//! |
| 56 | +//! ## NUMA awareness |
| 57 | +//! |
| 58 | +//! The tokio runtime is not NUMA (Non-Uniform Memory Access) aware. |
| 59 | +//! You may want to start multiple runtimes instead of a single runtime |
| 60 | +//! for better performance on NUMA systems. |
| 61 | +//! |
16 | 62 | //! # Usage
|
17 | 63 | //!
|
18 | 64 | //! When no fine tuning is required, the [`tokio::main`] attribute macro can be
|
|
0 commit comments