Skip to content

[Store] Add synthetic master workload benchmark - #3147

Open
zhangzuo21 wants to merge 1 commit into
kvcache-ai:mainfrom
zhangzuo21:agent/master-synthetic-bench
Open

zhangzuo21 wants to merge 1 commit into
kvcache-ai:mainfrom
zhangzuo21:agent/master-synthetic-bench

Conversation

@zhangzuo21

@zhangzuo21 zhangzuo21 commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR adds master_synthetic_bench, a standalone benchmark that generates a configurable, stateful workload for an already-running Mooncake master.

The existing master_bench focuses on driving one selected operation at maximum throughput. The new benchmark is intended for mixed and rate-controlled workloads:

  • independent Exist, Put, and Get streams for each segment;
  • Poisson or fixed open-loop request arrivals;
  • configurable per-segment QPS and batch sizes;
  • stateful BatchPutStart / BatchPutEnd transactions;
  • monotonically increasing, tagged key namespaces;
  • configurable key size, value size, replica count, and lookup hit ratios;
  • per-segment worker pools and bounded pending queues;
  • segment mount, heartbeat, remount, and cleanup handling;
  • overload detection without silently dropping or rate-limiting requests.

Only keys that successfully complete both PutStart and PutEnd are added to the committed-key pool used by later Exist and Get requests.

The benchmark connects to the master through --master_server. It does not start or modify the master, does not require a trace file, and does not introduce additional master or sender metrics.

This PR contains only:

  • the new benchmark executable;
  • its English usage and parameter documentation; and
  • the minimal CMake target required to build it.

There are no changes to existing master behavior or production APIs.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • [✅] Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • [✅] Docs
  • Other

Type of Change

  • Bug fix
  • [✅] New feature
  • Refactor
  • Breaking change
  • [✅] Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

@zhangzuo21
zhangzuo21 requested a review from ykwd as a code owner July 28, 2026 02:53
Copilot AI review requested due to automatic review settings July 28, 2026 02:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new standalone benchmark, master_synthetic_bench, intended to generate configurable mixed (Exist/Put/Get) open-loop workloads against an already-running Mooncake master, plus accompanying usage documentation and the minimal CMake target to build it.

Changes:

  • Add master_synthetic_bench C++ benchmark implementing per-segment open-loop scheduling, worker pools, segment mount/heartbeat/remount, and committed-key tracking for hit-ratio sampling.
  • Add English usage and parameter documentation for the new benchmark (MASTER_SYNTHETIC_BENCH.md).
  • Register the new benchmark executable in mooncake-store/benchmarks/CMakeLists.txt.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
mooncake-store/benchmarks/MASTER_SYNTHETIC_BENCH.md Adds build/run instructions, workload semantics, parameters, and exit-code documentation for the new benchmark.
mooncake-store/benchmarks/master_synthetic_bench.cpp Implements the synthetic benchmark: segment lifecycle + heartbeat, open-loop request scheduling, task queues, and RPC execution logic.
mooncake-store/benchmarks/CMakeLists.txt Adds the master_synthetic_bench executable target and links it against mooncake_store.
Comments suppressed due to low confidence (1)

mooncake-store/benchmarks/master_synthetic_bench.cpp:412

  • BatchGetReplicaList failure accounting similarly ignores short responses. If fewer results are returned than requested keys, the benchmark should treat the missing entries as failures so rpc_failure_events reflects partial/bad responses.
            const auto counts =
                CountExpectedResults(master_client_.BatchGetReplicaList(keys));
            if (counts.second != 0) {
                stats_.rpc_failure_events.fetch_add(1,
                                                    std::memory_order_relaxed);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +20 to +23
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_UNIT_TESTS=ON
cmake --build build --target master_synthetic_bench -j
Comment on lines +665 to +668
const long double nanoseconds = seconds * 1'000'000'000.0L;
return std::chrono::nanoseconds(
std::max<int64_t>(1, static_cast<int64_t>(nanoseconds)));
}
Comment on lines +374 to +395
const auto results = master_client_.BatchExistKey(keys);
uint64_t failed = 0;
uint64_t found = 0;
uint64_t missing = 0;
for (const auto& result : results) {
if (!result.has_value()) {
++failed;
} else {
if (*result) {
++found;
} else {
++missing;
}
}
}
stats_.exist_true_items.fetch_add(found, std::memory_order_relaxed);
stats_.exist_false_items.fetch_add(missing,
std::memory_order_relaxed);
if (failed != 0) {
stats_.rpc_failure_events.fetch_add(1,
std::memory_order_relaxed);
}
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 507 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...oncake-store/benchmarks/master_synthetic_bench.cpp 0.00% 507 Missing ⚠️

📢 Thoughts on this report? Let us know!

CAICAIIs added a commit to CAICAIIs/Mooncake that referenced this pull request Sep 1, 2026
…nch (PR kvcache-ai#3147)

read_path_bench: in-process master metadata read-path microbenchmark used for
the kvcache-ai#3670/kvcache-ai#3671 fast-path A/B (GetReplicaList throughput; 100k objects, 32
threads, 160k reqs -> +0.12% vs ca09c18 baseline).

master_synthetic_bench (PR kvcache-ai#3147): configurable synthetic master workload
benchmark against a live mooncake_master (mooncake::MasterClient, gRPC). Used
to measure the eviction scenario (medium + high load). Adapted BatchPutEnd to
the current vector<ObjectMeta> client API and added per-RPC latency percentiles
(p50/p99/p999, us) for exist/get/put. Measured high-load eviction p99/p999
drop to ~1.5-7 ms after kvcache-ai#3671 route sharding (vs ~130-280 ms baseline).
CAICAIIs added a commit to CAICAIIs/Mooncake that referenced this pull request Sep 1, 2026
…nch (PR kvcache-ai#3147)

read_path_bench: in-process master metadata read-path microbenchmark used for
the kvcache-ai#3670/kvcache-ai#3671 fast-path A/B (GetReplicaList throughput; 100k objects, 32
threads, 160k reqs -> +0.12% vs ca09c18 baseline).

master_synthetic_bench (PR kvcache-ai#3147): configurable synthetic master workload
benchmark against a live mooncake_master (mooncake::MasterClient, gRPC). Used
to measure the eviction scenario (medium + high load). Adapted BatchPutEnd to
the current vector<ObjectMeta> client API and added per-RPC latency percentiles
(p50/p99/p999, us) for exist/get/put. Measured high-load eviction p99/p999
drop to ~1.5-7 ms after kvcache-ai#3671 route sharding (vs ~130-280 ms baseline).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants