Letting the Transaction Scheduler Decide How Many Cores to Use

Systems that execute many transactions at once, such as databases, transactional memory, and blockchain execution engines, increasingly rely on predictive schedulers. These guess which data records each transaction will read and write before it runs, then order the transactions so they do not collide. The guessed sets are called read and write sets; a collision means two transactions touch the same record and one must wait or be aborted. Separately, decades of measurements show concurrency saturation: past some core count, adding threads stops helping and can hurt, because cores compete for memory bandwidth and shared caches even when they touch no common data.

The two lines of work have not been joined. Predictive schedulers assume that any two non-colliding transactions run side by side at full speed. Saturation studies treat the workload as a black box. Yet a predictive scheduler already holds the information needed to know, batch by batch, how much parallelism is worth buying. It knows the conflict structure of the upcoming batch, and from history it can estimate each transaction's memory traffic. Our claim is that the scheduler, not a separate thread-count knob, should choose the dispatch width (how many cores a batch actually uses). It should do so with a cost model that charges for shared memory bandwidth as well as logical conflicts, and release the remaining cores. We expect this to matter most when contention changes quickly from batch to batch, where a fixed or slowly adapting thread count is wrong much of the time.

Core Claim

The sharpest evidence for the gap is Conthereum. Conthereum schedules Ethereum smart-contract transactions across cores as a flexible job-shop problem, using conflicts found by static analysis and gas-based duration estimates. It reports near-linear speedup up to an "8-core sweet spot" and then a "non-monotonic speedup phenomenon" on 28 to 32 cores, yet it keeps dispatching across every core. Its cost model contains only gas duration.

Towards Optimal Transaction Scheduling does something similar for databases. It proves optimal scheduling NP-complete and proposes Shortest Makespan First (SMF), a greedy heuristic that appends whichever transaction least extends total completion time ("makespan"), driven by a few hot keys. SMF is built into RocksDB with a schedule-first multiversion protocol (the combination is called R-SMF), but it also models an idealized machine.

On the saturation side, AB-tree throttles above 18 threads, which it attributes to memory-bus and hyperthreading limits. IMSuite sees plateaus beyond 8 to 16 threads from cache-line invalidation. Parallel training of neural networks for speech recognition hits the CPU-to-RAM bandwidth wall. These papers motivate the proposal: logically disjoint work still saturates.

We replace the idealized step cost with one that has a bandwidth term. Suppose a scheduling step runs a set $S$ of mutually non-conflicting transactions. We estimate its duration as

$$ T(S) = \max\Big( \max_{i \in S} c_i,\; \frac{\sum_{i \in S} b_i}{B} \Big), $$

where $c_i$ is transaction $i$'s compute time when it runs alone, $b_i$ is the bytes of memory traffic it generates, and $B$ is the machine's sustainable memory bandwidth. In a multi-socket machine, $B$ is applied per socket.

The greedy scheduler adds a transaction to the current step only if doing so lowers projected throughput-per-step, so the width of each step falls out of the plan. Cores the plan does not need are put to sleep through a load-control mechanism. The form is the standard roofline-style bound: a step is limited by whichever resource, compute or bandwidth, is exhausted first.

Research Program

The first stage is diagnostic and could kill the project. On a two-socket machine with at least 32 physical cores and hyperthreading, we rerun SMF as a bolt-on over OCC and a Conthereum-style greedy scheduler. We use hardware performance counters to split worker idle and stall time into two parts: waiting caused by logical dependencies, and memory stalls or cache-coherence traffic. If memory stalls are a negligible share of the post-plateau loss, the bandwidth term is pointless. In that case the project shrinks to plan-derived width control alone, which the ablations below test anyway.

The second stage builds the estimator. $B$ is calibrated once per machine with a streaming microbenchmark. The per-transaction $b_i$ and $c_i$ are learned online per transaction type and hot-key class from counter samples, in the history-based spirit of Shrink's predictors in Preventing versus curing. We report the estimator's prediction error directly, because R-SMF showed that throughput degrades as its predictor's accuracy drops.

The third stage modifies the greedy schedulers to use $T(S)$. It also adds a cheap pairing rule that prefers to co-schedule bandwidth-heavy transactions with bandwidth-light ones. Released cores go through a sleep-slot mechanism borrowed from Decoupling contention management from scheduling. That work showed a user-level load controller keeps 85% of peak performance at 200% load, but its controller sees only runnable-thread counts. We supply it with a target width computed from the transaction plan instead.

Scheduler overhead counts against us. The scheduler's own cycles and cache footprint are measured inside the same runs, because the cost of the analysis phase grows relative to the parallel phase as core counts rise, a concern the file raises for Strife and for R-SMF's measured overhead.

Baselines

The naive reference is reactive OCC run on all hardware threads with no scheduling. This is the point predictive schedulers were invented to beat.

The strongest existing scheduler is SMF layered on OCC, and R-SMF inside RocksDB, from Towards Optimal Transaction Scheduling. It reports up to 3.9x throughput and 3.2x tail-latency reduction over RocksDB OCC, and up to 3.3x throughput as a bolt-on on TAOBench. On blockchain-style traces the strongest competitor is the Conthereum greedy scheduler, which reports up to 10.33x speedup for its Proposer mode at 32 cores and 15% conflict. Both run unmodified except for our instrumentation, on the same machine, traces and batch sizes. We count beating them as a statistically reliable throughput gain together with no worse 99th-percentile latency at 32 cores and above. Below the sweet spot we expect a tie.

The baseline we consider most dangerous is SMF or Conthereum with the best static thread count. That count comes from an offline sweep per workload and per machine, given the same tuning budget as our calibration. It is an oracle a careful operator could approximate. A second width baseline is an online hill-climbing controller that adjusts thread count from measured throughput, tuned on held-out traces.

Two ablations isolate the key ingredient. The first, logical-width-only, sets each batch's width from the plan's conflict structure and drops the bandwidth term. The second, bandwidth-only, keeps the bandwidth term but applies a single width to every batch. If logical-width-only matches the full system, the hardware model has not earned its place and we will say so.

Why not just…?

Why not just tune the thread count once? This is the real threat. On a stationary workload a well-chosen static width should capture nearly all of the gain, and we expect only to tie it there. The proposal's case rests on non-stationary workloads, where conflict rate and record size shift across consecutive batches, for example Ethereum blocks alternating between ordinary transfers and hot-contract bursts at 15% to 45% conflict. No single width is right for all of them. If the best static width is within noise of our system on those mixed traces too, the claim fails.

Why not just use a reactive load controller? The controller in Decoupling contention management from scheduling responds within 30 µs and stabilizes within 200 µs. The paper itself notes it is sensitive to large transient load changes. Batches that last a few hundred microseconds can therefore change character faster than it settles. Our planner knows the next batch's structure before dispatching it. The hill-climbing baseline measures exactly this lag-versus-foresight difference.

Why not just partition data statically or batch into conflict-free clusters? Strife, described in Improving High Contention OLTP Performance via Transaction Scheduling, already clusters conflict-free work, gaining up to 2x over two-phase locking and OCC. But it dispatches every cluster across all cores and leaves a serial residual. Static partitioning breaks down under skew and cross-partition transactions, as the same paper argues. Both address logical conflicts, not bandwidth. Our system also runs with Strife-style clustering as its plan source on TPC-C to show the width decision is complementary.

Proposed Experiments

Workloads are TPC-C at low and high warehouse counts, YCSB with Zipfian skew from uniform to above 1.0 using the benchmark's 1 KB records (YCSB), SmallBank, TAOBench, and Ethereum-style traces at 15%, 25%, 35% and 45% conflict with batches of 50 to 200 transactions. We add a memory-heavy variant of YCSB with larger records and scan-like reads to push bandwidth demand. We also add mixed traces that switch regime every few batches.

We sweep 1 to all hardware threads on the two-socket machine and report throughput, tail latency, abort rate, scheduler overhead, and energy per committed transaction, since released cores should save power.

The decisive checks are threefold. First, the full system must remove Conthereum's non-monotonic dip, so that throughput does not fall as available cores increase. Second, on mixed traces it must beat the best static width and the hill-climbing controller. Third, it must beat logical-width-only on the memory-heavy variants while tying it on compute-bound TPC-C. If only the first holds, the contribution is a usable width controller rather than a hardware-aware scheduler, and we would report it as such.