Repository navigation
perf: parallelize YCSB key preload - #253
Conversation
Greptile SummaryThe PR parallelizes YCSB key preloading through a bounded worker pool while retaining deterministic generation, ordered error reporting, and cancellation cleanup.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "perf: parallelize YCSB key preload" | Re-trigger Greptile |
Preload writes went one at a time: preloadKeys waited for each Put or PutStream before issuing the next, so the configured concurrency never applied to the load phase. One deterministic producer now generates keys and values in the original order (the RNG state after preload is unchanged), a worker pool sized by the configured concurrency performs the puts, and one collector owns the accounting, the 10% failure threshold, and the spinner. The job queue is bounded so values are released as their put completes. Rebased onto main after #260: the pool carries both the plain and the CAS preload namespaces and keeps the puts-based accounting; the tests were ported onto the CAS-aware test server. The PR's commits were squashed by the rebase. Signed-off-by: Perfloop Agent <agent@perfloop.ai> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCoN4Him5ZY4hZovVp37ra
79c5852 to
af7a3c6
Compare
|
Rebased onto main ( |
Problem
YCSB preloaded keys one at a time.
preloadKeyswaited for eachPutorPutStreamto return before issuing the next write, so the configured concurrency did not apply to the load phase. The benchmark starts after preload, but command completion still paid the serial load cost.Fix
Generate keys and values in one deterministic producer, then send bounded jobs to a worker pool sized by the configured concurrency. Workers share the existing client and perform writes concurrently, while a collector preserves completion accounting, progress updates, error handling, and the first-error ordering. All workers are joined before benchmark traffic starts.
The pool keeps only a bounded number of owned jobs in flight. It preserves the key/value mapping, later RNG state, streaming selection, cancellation behavior, and preload error threshold.
Workload:
RunYCSBWithContext with 64 100-byte preload keys, 64 read operations, 8 workers, loopback gRPC, and a 1 ms PutObject handler delayns/opTesting
TestPreloadKeysPreservesValuesAndRNGTestPreloadKeysPreservesErrorThresholdTestPreloadKeysWaitsForWorkersOnCancellationmake test-client TESTRUN=PreloadKeysmake fmt-checkGenerated by Perfloop. Measurements and checks.
Note
Low Risk
Benchmark-tooling change only; behavior is explicitly tested for parity with the serial preload (RNG, errors, cancellation).
Overview
Parallelizes YCSB key preload so the load phase respects
Concurrencyinstead of issuing one put at a time.preloadKeysnow uses a single deterministic producer (same key/value generation order and post-preload RNG state), a bounded job queue sized to the worker count, and a pool of workers that perform plain/streaming/CAS puts concurrently. A collector goroutine tracks successes, errors, spinner progress (by completed puts), cancellation, and picks the lowest-sequence error so the 10% failure threshold and “first error” message match the old serial behavior. Cancellation messaging reports completed puts vsexpectedPuts.Tests add a mock server with injectable put failures, latency, and concurrency tracking, plus coverage for correctness (values + RNG), error threshold, clean shutdown on cancel, and a preload benchmark.
Reviewed by Cursor Bugbot for commit af7a3c6. Bugbot is set up for automated code reviews on this repo. Configure here.