From 057e7cd7c95513db7cc1e33f3fe34fb93fc75775 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 31 Jan 2021 05:19:30 +0000 Subject: [PATCH] prepare rt v2.0.0-beta.3 --- actix-rt/CHANGES.md | 3 +++ actix-rt/Cargo.toml | 7 +++++-- actix-rt/README.md | 7 +++++++ actix-rt/src/lib.rs | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 actix-rt/README.md diff --git a/actix-rt/CHANGES.md b/actix-rt/CHANGES.md index a18c57d8..d3b74137 100644 --- a/actix-rt/CHANGES.md +++ b/actix-rt/CHANGES.md @@ -1,6 +1,9 @@ # Changes ## Unreleased - 2021-xx-xx + + +## 2.0.0-beta.3 - 2021-01-31 * Remove `run_in_tokio`, `attach_to_tokio` and `AsyncSystemRunner`. [#253] * Return `JoinHandle` from `actix_rt::spawn`. [#253] * Remove old `Arbiter::spawn`. Implementation is now inlined into `actix_rt::spawn`. [#253] diff --git a/actix-rt/Cargo.toml b/actix-rt/Cargo.toml index 68ed8563..65877abd 100644 --- a/actix-rt/Cargo.toml +++ b/actix-rt/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "actix-rt" -version = "2.0.0-beta.2" -authors = ["Nikolay Kim "] +version = "2.0.0-beta.3" +authors = [ + "Nikolay Kim ", + "Rob Ede ", +] description = "Tokio-based single-thread async runtime for the Actix ecosystem" keywords = ["network", "framework", "async", "futures"] homepage = "https://actix.rs" diff --git a/actix-rt/README.md b/actix-rt/README.md new file mode 100644 index 00000000..f58c2f4f --- /dev/null +++ b/actix-rt/README.md @@ -0,0 +1,7 @@ +# actix-rt + +> Tokio-based single-thread async runtime for the Actix ecosystem. + +See documentation for detailed explanations these components: [https://docs.rs/actix-rt][docs]. + +[docs]: https://docs.rs/actix-rt diff --git a/actix-rt/src/lib.rs b/actix-rt/src/lib.rs index bf8a4796..09d155e5 100644 --- a/actix-rt/src/lib.rs +++ b/actix-rt/src/lib.rs @@ -1,4 +1,37 @@ //! Tokio-based single-thread async runtime for the Actix ecosystem. +//! +//! In most parts of the the Actix ecosystem, it has been chosen to use !Send futures. For this +//! reason, a single-threaded runtime is appropriate since it is guaranteed that futures will not +//! be moved between threads. This can result in small performance improvements over cases where +//! atomics would otherwise be needed. +//! +//! To achieve similar performance to multi-threaded, work-stealing runtimes, applications +//! using `actix-rt` will create multiple, mostly disconnected, single-threaded runtimes. +//! This approach has good performance characteristics for workloads where the majority of tasks +//! have similar runtime expense. +//! +//! The disadvantage is that idle threads will not steal work from very busy, stuck or otherwise +//! backlogged threads. Tasks that are disproportionately expensive should be offloaded to the +//! blocking thread-pool using [`task::spawn_blocking`]. +//! +//! # Examples +//! ``` +//! use std::sync::mpsc; +//! use actix_rt::{Arbiter, System}; +//! +//! let _ = System::new(); +//! +//! let (tx, rx) = mpsc::channel::(); +//! +//! let arbiter = Arbiter::new(); +//! arbiter.spawn_fn(move || tx.send(42).unwrap()); +//! +//! let num = rx.recv().unwrap(); +//! assert_eq!(num, 42); +//! +//! arbiter.stop(); +//! arbiter.join().unwrap(); +//! ``` #![deny(rust_2018_idioms, nonstandard_style)] #![allow(clippy::type_complexity)]