RFC: Tail-Latency Isolation Under Shared Scheduling of Heterogeneous Workloads
Summary
This RFC seeks maintainer feedback on a composability tradeoff observed when heterogeneous parallel workload stages share a oneTBB scheduling domain.
Shared scheduling can improve CPU utilization by allowing otherwise independent stages to draw from common execution capacity. However, when task durations differ substantially, long-running non-preemptive work can interfere with newly-ready, short critical-path work and increase ready-to-start latency.
Before exploring an implementation, I would like maintainer guidance on whether improving this tradeoff is within oneTBB's intended scope, or whether such isolation should remain an application-level responsibility.
Problem
Applications increasingly compose multiple independently parallel CPU stages (especially tooling/agent use case), for example:
- parsing followed by numerical processing;
- database/query pipelines;
- media-processing pipelines;
- search/retrieval pipelines;
- dynamic DAG workloads.
There are two straightforward ways to schedule these components.
-> Independent concurrency domains
Each component maintains its own concurrency limit or worker pool.
This can provide useful isolation: long-running work in one component cannot occupy all execution capacity available to another.
The disadvantage is capacity fragmentation. When demand moves between stages, one domain may have idle capacity while another has queued work.
-> Shared scheduling domain
Compatible work can instead execute through a common oneTBB arena. This allows idle execution capacity to be reused dynamically and avoids some of the fragmentation created by static partitioning.
However, this introduces a different problem.
Consider a shared arena containing:
- relatively long-running CPU tasks, and
- short tasks that have just become ready on the application's critical path.
If workers are already executing the longer tasks, the short work can experience significant ready to start latency even though it is more latency-sensitive.
The resulting tradeoff is therefore:
static partitioning --> isolation but possible capacity fragmentation (possible today?) vs shared scheduling --> capacity reuse but possible tail-latency interference
Motivation: Emerging Orchestrated Workloads
The motivation for investigating this tradeoff comes partly from emerging agentic and tool driven workloads.
These applications often differ from traditional bulk-parallel workloads. A single application may dynamically compose parsing, tokenization, retrieval, numerical kernels, image or document processing, serialization, and other CPU work around asynchronous model or accelerator operations.
The application itself may be implemented using an asynchronous runtime such as a Rust, Python, or C++ orchestration framework. That runtime may coordinate I/O, accelerators, model calls, and dependencies, but it does not necessarily provide a common scheduling domain for CPU-heavy libraries invoked by the application.
As a result, multiple independently parallel CPU components may coexist inside one process.
The goal is not to make oneTBB an agent framework or orchestration runtime.
Rather, a useful role for oneTBB could be to remain a general-purpose, composable CPU execution substrate beneath these higher-level runtimes:
high-level orchestration --> asynchronous waits and dependencies
oneTBB --> efficient execution and composition of ready CPU work
For such workloads, composability requires more than avoiding oversubscription. Ideally, independently developed CPU components should be able to share available execution capacity without requiring developers to statically partition cores, while still avoiding excessive interference between long-running work and newly-ready short critical-path tasks.
The same property is useful outside agentic AI and applies to database engines, media pipelines, simulations, search systems, and other heterogeneous task graphs.
Existing Mechanisms Considered
I have experimented with existing mechanisms including:
- arena priority;
- bounded concurrency for longer-running stages;
- finer task decomposition.
These can change the operating point, but so far I have not found a configuration that generally preserves both the capacity-reuse advantage of shared scheduling and the tail isolation provided by separate concurrency domains.
In particular, static concurrency limits can restore isolation by effectively recreating the partitioning that shared scheduling was intended to avoid.
I am intentionally not proposing a new API or scheduler implementation in this RFC.
Goal -
The capability I am interested in is general rather than workload-specific:
Allow heterogeneous stages to share execution capacity elastically while limiting excessive ready to start delay for newly ready, latency sensitive work.
Ideally this would preserve normal work conservation: when no latency-sensitive work is ready, longer-running work should be able to consume available execution capacity.
The question is whether oneTBB should provide any scheduler-level mechanism or policy that helps achieve this property.
Possible implementations could range from an internal scheduling improvement to an existing mechanism I have overlooked.
Questions for Maintainers
Is improving tail-latency isolation while preserving work-conserving shared scheduling consistent with oneTBB's composability goals?
Is this tradeoff something oneTBB's scheduler should help address, or is explicit application-level concurrency partitioning considered the preferred solution?
Are there existing oneTBB mechanisms or scheduler patterns that are intended to handle this case and that I should evaluate before investigating scheduler changes?
If this is considered a reasonable scheduler problem, would maintainers prefer investigation of an internal scheduling policy first, rather than introducing any new public API?
I have a reproducible heterogeneous workload and cross-platform measurements that motivated this RFC. I can provide the reproducer and detailed measurements if that would be useful for evaluating the design question.
Source: uxlfoundation/oneTBB