Skip to content

Commit ad16179

Browse files
committed
Add note about spawn blocking
1 parent 118cce4 commit ad16179

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

datafusion/core/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
//! sensitive I/O work on the same thread pool ([`Runtime`]).
487487
//! Using the same (default) `Runtime` is convenient, and often works well for
488488
//! initial development and processing local files, but it can lead to problems
489-
//! under load when reading from network sources such as AWS S3.
489+
//! under load and/or when reading from network sources such as AWS S3.
490490
//!
491491
//! If your system does not fully utilize either the CPU or network bandwidth
492492
//! during execution, or you see significantly higher tail (e.g. p99) latencies
@@ -571,6 +571,13 @@
571571
//! time
572572
//!```
573573
//!
574+
//! Note that DataFusion does not use [`tokio::task::spawn_blocking`] for
575+
//! CPU-bounded work, because `spawn_blocking` is designed for blocking **IO**,
576+
//! not designed CPU bound tasks. Among other challenges, spawned blocking
577+
//! tasks can't yield waiting for input (can't call `await`) so they
578+
//! can't be used to limit the number of concurrent CPU bound tasks or
579+
//! keep the processing pipeline to the same core.
580+
//!
574581
//! [Tokio]: https://tokio.rs
575582
//! [`Runtime`]: tokio::runtime::Runtime
576583
//! [`task`]: tokio::task

0 commit comments

Comments
 (0)