Skip to content

[Store] Add Go dummy client benchmark support - #3015

Open
BGQ99 wants to merge 7 commits into
kvcache-ai:mainfrom
BGQ99:pr29-clean
Open

BGQ99 wants to merge 7 commits into
kvcache-ai:mainfrom
BGQ99:pr29-clean

Conversation

@BGQ99

@BGQ99 BGQ99 commented Jul 21, 2026

Copy link
Copy Markdown

Description

Related RFC: #3068

This PR manually ports the Go DummyClient benchmark and supporting Store APIs
from zchuango/Mooncake#29
onto kvcache-ai/Mooncake:main.

It allows independent Go worker processes to use DummyClient and registered
shared-memory buffers while a standalone mooncake_client owns the RealClient
and performs the actual Store operations.

What changed

  • Preserve the existing C and Go RealClient creation and setup APIs.
  • Add dedicated C API entry points for creating and setting up DummyClient.
  • Add the Go-native ClientType, NewWithType, and DummySetup APIs.
  • Add registered-buffer enumeration and hot-cache pointer queries through the
    C and Go APIs.
  • Add a multi-process Go DummyClient write/read benchmark.
  • Pass replica-num through ReplicateConfig.
  • Propagate operation, verification, and worker failures through non-zero exit
    statuses.
  • Validate buffer capacity, platform integer ranges, and memory access.
  • Keep CGo implementation types internal to the Go binding package.
  • Fix registered-buffer cleanup so shrinking the collection cannot skip
    entries.
  • Avoid redundant expired-client shared-memory cleanup when the context has
    already been removed.
  • Reuse the upstream single-object put_from implementation backed by
    batch_put_from instead of retaining a separate RPC helper.

Scope

  • mooncake-store/benchmarks/stress_cluster_bench.cpp from the source PR is
    intentionally excluded.
  • The existing C and Go RealClient APIs remain source-compatible.
  • DummyClient support is exposed through additional API entry points.
  • The final PR diff contains 8 Mooncake Store files.
  • No CI, workflow, documentation, Transfer Engine, EP, or unrelated repository
    changes are included.

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)
  • CI/CD
  • Docs
  • Other

Type of Change

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

How Has This Been Tested?

The final branch was rebuilt and the DummyClient write/read flow was rerun
against an isolated local master and standalone client.

Test configuration:

  • 1 worker
  • 2 keys
  • 4096 bytes per value
  • 1 replica
  • 4 MiB local buffer
  • TCP transport

Results:

  • mooncake_store, mooncake_master, and mooncake_client built
    successfully.

  • The Go DummyClient benchmark built successfully.

  • Dummy write completed 2/2 operations with 0 failures.

  • Dummy read completed 2/2 operations with 0 failures.

  • 8192 bytes were read with 0 verification errors.

  • Both benchmark commands returned exit status 0.

  • Unit tests pass

  • Integration tests pass (if applicable)

  • Manual testing done

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit run --all-files and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used

AI assistance was used to inspect the source PR, manually port the selected
changes, isolate unrelated branch history, diagnose build and runtime issues,
address review feedback, resolve the upstream merge conflict, run local
validation, and draft the RFC and PR description.

The human submitter remains responsible for reviewing, understanding, and
defending the final changes.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a multi-process benchmark tool and extends the Go bindings to support the DummyClient store type, including APIs for querying and managing registered buffers. The code review identified several critical issues: a hardcoded absolute path in CFLAGS that breaks portability, exposure of internal C types in the public Go API, and an index-shifting bug in UnregisterAllBuffers that leads to skipped buffers. Additionally, the feedback highlights dead code, potential out-of-bounds panics in the benchmark tool, outdated unsafe pointer patterns, and platform-dependent portability bugs in the CPU affinity binding implementation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mooncake-store/go/mooncakestore/store.go
Comment thread mooncake-store/go/mooncakestore/store.go
Comment thread mooncake-store/go/mooncakestore/store.go
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go Outdated
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go Outdated
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go Outdated
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go
Comment thread mooncake-store/go/examples/dummy_clients_test/main.go Outdated
@kvcache-ai kvcache-ai deleted a comment from gemini-code-assist Bot Jul 22, 2026
@BGQ99
BGQ99 marked this pull request as ready for review July 27, 2026 12:43
@BGQ99
BGQ99 requested review from XucSh, YiXR, stmatengss and ykwd as code owners July 27, 2026 12:43
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@zchuango

zchuango commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Hi @ykwd and @stmatengss,

We’ve updated this PR, resolved the upstream merge conflict, and addressed all
existing review threads. The final branch was rebuilt and manually verified
with 2/2 writes, 2/2 reads, and 0 verification errors.

The GitHub Actions workflows are still awaiting maintainer approval. When
convenient, could you please help approve the workflows and take another look
at the PR? Thank you!

@stmatengss stmatengss self-assigned this Aug 9, 2026
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.

3 participants