Skip to content

Conversation

@YiXR
Copy link
Collaborator

@YiXR YiXR commented Dec 31, 2025

Description

Type of Change

  • Types
    • Bug fix
    • New feature
      • Transfer Engine
      • Mooncake Store
      • Mooncake EP
      • Integration
      • P2P Store
      • Python Wheel
    • Breaking change
    • CI/CD
    • Documentation update
    • Other

How Has This Been Tested?

Checklist

  • I have performed a self-review of my own code.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @YiXR, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the mooncake-store's tiered caching system by integrating DRAM as a first-class memory tier. It introduces a new DramCacheTier implementation, refactors data handling with a BufferBase abstraction, and updates the TieredBackend to dynamically configure and manage DRAM resources, including NUMA support. The changes enable flexible memory allocation and data management across different tiers, backed by extensive new unit tests.

Highlights

  • DRAM Tier Support: Introduced a new DramCacheTier class to enable DRAM as a cache tier within the tiered backend, allowing for in-memory data storage and management.
  • Memory Buffer Abstraction: Refactored the DataSource struct to use a new BufferBase abstract class, along with concrete DRAMBuffer and TempDRAMBuffer implementations, providing a more robust and type-safe way to handle various memory buffers.
  • Tiered Backend Configuration: Updated the TieredBackend initialization to parse JSON configurations for DRAM tiers, supporting parameters like capacity, priority, NUMA node affinity, and allocator type (OFFSET or CACHELIB).
  • Efficient Data Handling: Implemented move semantics (std::move) for TieredLocation and DataSource in key operations like AllocationEntry construction and FreeInternal to improve performance and resource management.
  • DRAM-to-DRAM Data Copier: Added a dedicated CopyDramToDram function and registered it in the DataCopierBuilder to optimize data transfer operations specifically between DRAM locations.
  • Comprehensive Unit Tests: Included a new tiered_backend_test.cpp file with extensive unit tests covering the TieredBackend's functionality, including DRAM tier initialization, allocation, write, commit, get, and delete operations, ensuring the reliability of the new features.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@YiXR YiXR requested a review from wanyue-wy December 31, 2025 09:10
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 support for a DRAM cache tier, a significant new feature. The changes are well-structured, including a new DramCacheTier implementation, an abstraction for data sources using BufferBase, and detailed configuration parsing. The addition of a comprehensive test suite is particularly commendable. My review has identified a few issues: a design point that could affect future extensibility to other storage types, a bug in memory usage tracking, and a critical issue in an error handling path. Addressing these points will improve the robustness and future-proofing of the tiered storage backend.

default:
LOG(ERROR) << "Unsupported allocator type for DramCacheTier";
if (engine_) {
engine_->unregisterLocalMemory(mem_ptr, capacity_);
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The call to unregisterLocalMemory here uses two arguments: engine_->unregisterLocalMemory(mem_ptr, capacity_). However, in the DramCacheTier destructor, the same function is called with only one argument: engine_->unregisterLocalMemory(memory_buffer_.get()). This inconsistency suggests a potential bug. If the TransferEngine API expects one argument for unregistering, this call in the error handling path will fail to compile or cause a runtime error, possibly leading to resource leaks.

Suggested change
engine_->unregisterLocalMemory(mem_ptr, capacity_);
engine_->unregisterLocalMemory(mem_ptr);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

YiXR added 3 commits December 31, 2025 17:28
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
@YiXR YiXR force-pushed the xinyi/tiered-backend-next branch from 02312c2 to 925fb18 Compare December 31, 2025 09:29
YiXR added 2 commits January 6, 2026 15:24
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
YiXR added 3 commits January 8, 2026 11:44
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
@wanyue-wy wanyue-wy merged commit bd71efe into kvcache-ai:P2P-Mooncake-Store Jan 8, 2026
14 checks passed
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.

2 participants