Skip to content

[Misc] Improve nixl perf in lmcache mp#2711

Merged
YaoJiayi merged 3 commits intodevfrom
localdev/nixl-v2
Mar 7, 2026
Merged

[Misc] Improve nixl perf in lmcache mp#2711
YaoJiayi merged 3 commits intodevfrom
localdev/nixl-v2

Conversation

@YaoJiayi
Copy link
Copy Markdown
Collaborator

@YaoJiayi YaoJiayi commented Mar 7, 2026

What this PR does / why we need it:
Specify file size in nixl backend.
Special notes for your reviewers:

If applicable:

  • this PR contains user facing changes - docs added
  • this PR contains unit tests

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 enhances the performance of Nixl within LMCache's multiprocess environment by optimizing file-based storage management. It introduces a mechanism to consolidate multiple L1 memory pages into larger storage files, which streamlines I/O operations and reduces system resource overhead. Additionally, a minor adjustment was made to prevent busy-waiting in a critical lookup path, contributing to overall system efficiency.

Highlights

  • Nixl File Storage Optimization: Introduced a 'file_size' parameter for file-based Nixl backends, allowing multiple L1 pages to be stored within a single file, thereby reducing the number of file descriptors and improving I/O efficiency.
  • Configuration Update: Updated the configuration help text to include the new 'file_size' parameter for Nixl backend parameters, providing clearer guidance for users.
  • Busy-Waiting Prevention: Added a small 'time.sleep' delay in the 'lookup' method's polling loop to prevent busy-waiting and reduce CPU consumption during status checks.

🧠 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.

Changelog
  • lmcache/v1/distributed/l2_adapters/config.py
    • Updated the help string for Nixl backend parameters to include the new 'file_size' option.
  • lmcache/v1/distributed/l2_adapters/nixl_store_l2_adapter.py
    • Refactored the initialization of 'NixlObjPool' to be conditional on the backend type.
    • Introduced 'file_size' parameter for file-based storage handlers, allowing a single file to contain multiple pages.
    • Modified 'init_storage_handlers_file' to accept 'num_files' and 'file_size', and to correctly register memory and transfer descriptors for multi-page files.
    • Added validation to ensure 'file_size' is a multiple of 'page_size'.
  • lmcache/v1/multiprocess/server.py
    • Added a 'time.sleep' call in the 'lookup' method's polling loop to prevent busy-waiting.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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.

Copy link
Copy Markdown
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 a performance improvement for the nixl storage backend by allowing multiple pages to be grouped into a single file, which reduces the number of open file descriptors. The changes are primarily in nixl_store_l2_adapter.py to support a file_size parameter. Additionally, a time.sleep() is added to a busy-wait loop in server.py to reduce CPU consumption.

The overall approach is solid, but I've identified a critical bug in the new implementation within nixl_store_l2_adapter.py where an incorrect variable is passed to a function, which would likely cause transfers to fail. Please see the specific comment for details and a suggested fix.

YaoJiayi added 2 commits March 7, 2026 01:31
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Copy link
Copy Markdown
Contributor

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

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

LGTM!

@ApostaC ApostaC added the full Run comprehensive tests on this PR label Mar 7, 2026
Copy link
Copy Markdown
Contributor

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

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

one minor comment

if found_count is not None:
break

time.sleep(0.001)
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.

Let's don't have this here but have #2710 merged. That will the problem here

@ApostaC ApostaC requested a review from KuntaiDu March 7, 2026 03:59
Copy link
Copy Markdown
Contributor

@KuntaiDu KuntaiDu left a comment

Choose a reason for hiding this comment

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

lgtm!

@YaoJiayi YaoJiayi merged commit 284176a into dev Mar 7, 2026
23 of 28 checks passed
mauryaavinash95 pushed a commit to mauryaavinash95/LMCache that referenced this pull request Mar 7, 2026
* add file size config

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* fix minor

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* revert some logs

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

---------

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
@YaoJiayi YaoJiayi deleted the localdev/nixl-v2 branch March 10, 2026 17:36
shaoxiawjc pushed a commit to shaoxiawjc/LMCache that referenced this pull request Mar 11, 2026
* add file size config

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* fix minor

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* revert some logs

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

---------

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: shaoxiawjc <wjc2800@163.com>
realAaronWu pushed a commit to realAaronWu/LMCache that referenced this pull request Mar 20, 2026
* add file size config

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* fix minor

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* revert some logs

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

---------

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: Aaron Wu <aaron.wu@dell.com>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
* add file size config

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* fix minor

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* revert some logs

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

---------

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
* add file size config

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* fix minor

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

* revert some logs

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>

---------

Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full Run comprehensive tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants