Skip to content

[Bugfix][Store] Use memcpy instead of loopback TCP when getting offload objects in the same process - #5781

Open
bistack wants to merge 1 commit into
kvcache-ai:mainfrom
bistack:pr/offload-local-memcpy
Open

bistack wants to merge 1 commit into
kvcache-ai:mainfrom
bistack:pr/offload-local-memcpy

Conversation

@bistack

@bistack bistack commented Nov 24, 2026 •

Copy link
Copy Markdown

Description

Getting an offload object whose source lives in this process went through the transfer engine over loopback TCP instead of a local memcpy. Local memcpy was selected only for requests flagged kLocalAddress, and these requests are not flagged that way.

With MC_STORE_MEMCPY=1, local memcpy is now used whenever the source is in this process, for either buffer access mode. A kLocalAddress request whose source is not in this process is still rejected.

Suggested Merge Priority

  • P2 — Normal: Routine bug fix, validated performance/compatibility improvement, or new feature for a confirmed use case

Module

  • Mooncake Store (mooncake-store)

Type of Change

  • Bug fix
  • Performance improvement

How Has This Been Tested?

Test commands:

./scripts/code_format.sh --changed-lines --check
pre-commit run --files mooncake-store/src/transfer_task.cpp mooncake-store/tests/transfer_task_test.cpp
./mooncake-store/tests/transfer_task_test --gtest_filter='TransferTaskTest.BatchGetOffloadObject*'

Test results:

  • Unit tests pass
  • Integration tests pass (if applicable)

Checklist

  • Every commit I contribute includes my Signed-off-by trailer certifying the DCO
  • 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 on the files changed in this PR and all hooks pass
  • I have added tests to prove my changes are effective

AI Assistance Disclosure

  • AI tools were used (specify below)

OpenAI Codex assisted with the initial version of the change. ZCode (powered by GLM-5.4) prepared the branch, simplified the condition and its comment, ran the local checks, and wrote this description.

@bistack
bistack force-pushed the pr/offload-local-memcpy branch 4 times, most recently from 5247065 to b4dc9e5 Compare November 24, 2026 04:34
@bistack bistack changed the title [Store] Use local memcpy for same-process offload restores with RPC leases [Store] Use memcpy instead of loopback TCP for same-process offload restores Nov 24, 2026
@bistack
bistack force-pushed the pr/offload-local-memcpy branch from b4dc9e5 to 2cc3b6c Compare November 24, 2026 04:36
@bistack bistack changed the title [Store] Use memcpy instead of loopback TCP for same-process offload restores [Store] Use memcpy instead of loopback TCP for same-process offload reads Nov 24, 2026
@bistack
bistack force-pushed the pr/offload-local-memcpy branch from 2cc3b6c to 2517047 Compare November 24, 2026 04:37
@bistack bistack changed the title [Store] Use memcpy instead of loopback TCP for same-process offload reads [Store] Use memcpy instead of loopback TCP when restoring offload objects in the same process Nov 24, 2026
…ts in the same process

Getting an offload object whose source lives in this process went
through the transfer engine over loopback TCP instead of a local memcpy:
local memcpy was selected only for requests flagged kLocalAddress, and
these requests are not flagged that way.

With MC_STORE_MEMCPY=1, use local memcpy whenever the source is in this
process, for either buffer access mode. A kLocalAddress request whose
source is not in this process is still rejected.

Signed-off-by: Sun Zhenyuan <zhenyuan.sun@163.com>
@bistack
bistack force-pushed the pr/offload-local-memcpy branch from 2517047 to 8cc2923 Compare November 24, 2026 04:39
@bistack bistack changed the title [Store] Use memcpy instead of loopback TCP when restoring offload objects in the same process [Store] Use memcpy instead of loopback TCP when getting offload objects in the same process Nov 24, 2026
@github-actions github-actions Bot added the size/S 0-99 changed lines (additions + deletions) label Nov 24, 2026
@bistack
bistack marked this pull request as ready for review November 24, 2026 04:42
Copilot AI balanced review requested due to automatic review settings November 24, 2026 04:42

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@bistack bistack changed the title [Store] Use memcpy instead of loopback TCP when getting offload objects in the same process [Bugfix][Store] Use memcpy instead of loopback TCP when getting offload objects in the same process Nov 24, 2026
@bistack

bistack commented Nov 25, 2026

Copy link
Copy Markdown
Author

@ykwd Could you help with this PR? The latest CI run (Build & Test (Linux), run 45327885081) has failing checks, but they are caused by infrastructure interruptions rather than the code change:

  • CTest unit tests (Python 3.12) — CANCELLED after running for exactly 6 hours (job timeout)
  • tent-ci (cuda-off) — the runner received a shutdown signal mid-build (ninja: build stopped: interrupted by user, exit code 143), with no compile errors; it died at step [265/646]
  • CI Gate — failed only because it aggregates the two checks above

All other checks passed (format, Ruff, typos, macOS build, wheel builds for CU13 / CU13-arm64 / ROCm / XPU, EFA unit tests, test-wheel-ubuntu, and the other three tent-ci variants).

Since re-running requires write access, could you please re-run the failed jobs of that run? A code review of the memcpy change in mooncake-store/src/transfer_task.cpp would also be much appreciated.

cc @stmatengss

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

Labels

run-ci size/S 0-99 changed lines (additions + deletions) Store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants