Repository navigation
Valkey connector - #1743
Valkey connector#1743
Conversation
Summary of ChangesHello @bluayer, 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 introduces a new Valkey connector to LMCache, significantly expanding its storage backend options. The integration provides robust support for both standalone and clustered Valkey environments, leveraging the valkey-glide client for optimized data retrieval and storage. This enhancement is designed to improve performance and flexibility for users seeking a high-performance, Redis-compatible caching solution. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a Valkey connector for LMCache, supporting both standalone and cluster modes. The implementation is well-structured and includes performance optimizations like pipelining. My review focuses on improving code maintainability by reducing duplication, increasing the robustness of URL parsing, and enhancing the completeness of the new tests. Overall, this is a solid contribution, and the suggested changes aim to make the code even more robust and easier to maintain.
5b6a6a3 to
99ee726
Compare
|
@maobaolong Would you like to take a look at this PR? |
|
Hi @maobaolong, This PR is quite large, and I know you're busy, but would you review it please? |
|
@bluayer First of all, may i ask whether you use valkey enable RDMA? Or just use tcp mode? |
|
@maobaolong Thank you for your response. Only use tcp in this PR. Because the main client used and developed by valkey org, valkey-glide, does not yet support RDMA. (Ref : valkey-io/valkey-glide#1963) I plan to work on adding RDMA support after merging this connector. |
|
@bluayer, do you have any benchmarks on the read and write throughput (in terms of GB / s) of Valkey? (any benchmarking utility is fine)? :) Also, would you mind updating the docs? https://docs.lmcache.ai/kv_cache/storage_backends/valkey.html |
sammshen
left a comment
There was a problem hiding this comment.
LGTM on first pass! Please add documentation
|
Hi @maobaolong, I've applied all of your feedback. Please check it out :) Also I added the document for valkey connector. And @sammshen, I don't have my own benchmark results but you can estimate throughput by this official blog post(https://valkey.io/blog/unlock-one-million-rps/). Valkey 7.2 is completely identical to Redis 7.2, so this high performance has been supported since Valkey 8 released last year. |
|
you can mock the behavior in the unit tests |
maobaolong
left a comment
There was a problem hiding this comment.
@bluayer Left a comment within get method.
maobaolong
left a comment
There was a problem hiding this comment.
@bluayer Left a minor comment inline. Otherwise, LGMT.
|
please merge from #1833 (comment) to fix integration tests |
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
- Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com>
- Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
- Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
Signed-off-by: Jungwoo Song <bluayer@gmail.com>
bee0f18 to
afcdee2
Compare
|
@sammshen I pull dev branch and rebase this branch. Thank you. |
|
thanks @bluayer for the PR and @maobaolong for the great feedback! |
|
this is awesome! thank you @bluayer |
* feat: Add dependency for valkey-glide Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add Valkey adapter - Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Valkey Connector - Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com> * test: add test for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: add specific version for supporting pipelinig Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: linting Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: add checking memory equality at test Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Use extra config for simple paramters Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: remove valkey-glide depedency from common.txt Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add try-except and prevent memory leak - Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: double check for config and extra_config Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: lint Signed-off-by: Jungwoo Song <bluayer@gmail.com> * docs: Add docs for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: Move import statement to the head of file and exception handling Signed-off-by: Jungwoo Song <bluayer@gmail.com> --------- Signed-off-by: Jungwoo Song <bluayer@gmail.com> Signed-off-by: TaoZQY <zhangtaolqy@mail.ustc.edu.cn>
* feat: Add dependency for valkey-glide Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add Valkey adapter - Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Valkey Connector - Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com> * test: add test for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: add specific version for supporting pipelinig Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: linting Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: add checking memory equality at test Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Use extra config for simple paramters Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: remove valkey-glide depedency from common.txt Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add try-except and prevent memory leak - Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: double check for config and extra_config Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: lint Signed-off-by: Jungwoo Song <bluayer@gmail.com> * docs: Add docs for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: Move import statement to the head of file and exception handling Signed-off-by: Jungwoo Song <bluayer@gmail.com> --------- Signed-off-by: Jungwoo Song <bluayer@gmail.com> Signed-off-by: TaoZQY <zhangtaolqy@mail.ustc.edu.cn>
* feat: Add dependency for valkey-glide Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add Valkey adapter - Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Valkey Connector - Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com> * test: add test for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: add specific version for supporting pipelinig Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: linting Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: add checking memory equality at test Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Use extra config for simple paramters Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: remove valkey-glide depedency from common.txt Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add try-except and prevent memory leak - Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: double check for config and extra_config Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: lint Signed-off-by: Jungwoo Song <bluayer@gmail.com> * docs: Add docs for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: Move import statement to the head of file and exception handling Signed-off-by: Jungwoo Song <bluayer@gmail.com> --------- Signed-off-by: Jungwoo Song <bluayer@gmail.com>
* feat: Add dependency for valkey-glide Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add Valkey adapter - Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Valkey Connector - Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com> * test: add test for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: add specific version for supporting pipelinig Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: linting Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: add checking memory equality at test Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Use extra config for simple paramters Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: remove valkey-glide depedency from common.txt Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add try-except and prevent memory leak - Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: double check for config and extra_config Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: lint Signed-off-by: Jungwoo Song <bluayer@gmail.com> * docs: Add docs for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: Move import statement to the head of file and exception handling Signed-off-by: Jungwoo Song <bluayer@gmail.com> --------- Signed-off-by: Jungwoo Song <bluayer@gmail.com> Signed-off-by: Lee Yao Yang <leey0227@e.ntu.edu.sg>
* feat: Add dependency for valkey-glide Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add Valkey adapter - Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Valkey Connector - Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com> * test: add test for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: add specific version for supporting pipelinig Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: linting Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: add checking memory equality at test Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Use extra config for simple paramters Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: remove valkey-glide depedency from common.txt Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add try-except and prevent memory leak - Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: double check for config and extra_config Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: lint Signed-off-by: Jungwoo Song <bluayer@gmail.com> * docs: Add docs for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: Move import statement to the head of file and exception handling Signed-off-by: Jungwoo Song <bluayer@gmail.com> --------- Signed-off-by: Jungwoo Song <bluayer@gmail.com>
* feat: Add dependency for valkey-glide Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add Valkey adapter - Using same url prefix(valkey://) supporting standalone and cluster mode - Use query param for checking mode. - Standalone mode supports selecting database and cluster mode doesn't support it (but after Valkey 9, it can support database mode) Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Valkey Connector - Implement valkey connector based on redis connector but using other library, Valkey-GLIDE managed by Valkey organization. - Use mget and pipeline put at standalone and cluster mode - Use Hash slot for reducing network latency at cluster mode. - When tested with 10 keys, Valkey connector is 5 ~ 20% faster at standalone mode and up to 70%(avg 60%+) faster at cluster mode. Signed-off-by: Jungwoo Song <bluayer@gmail.com> * test: add test for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: add specific version for supporting pipelinig Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: linting Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: add checking memory equality at test Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Use extra config for simple paramters Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: remove valkey-glide depedency from common.txt Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: Add try-except and prevent memory leak - Add try-except under assert statement for checking error - Add memory_obj.ref_count_down() for preventing memory leak Signed-off-by: Jungwoo Song <bluayer@gmail.com> * feat: double check for config and extra_config Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: lint Signed-off-by: Jungwoo Song <bluayer@gmail.com> * docs: Add docs for valkey connector Signed-off-by: Jungwoo Song <bluayer@gmail.com> * fix: Move import statement to the head of file and exception handling Signed-off-by: Jungwoo Song <bluayer@gmail.com> --------- Signed-off-by: Jungwoo Song <bluayer@gmail.com>
What this PR does / why we need it:
This PR implements Valkey connector support for LMCache, addressing issue #1621.
Key implementations:
Performance test example :
(Random 10keys, cluster mode with 3 shards.)
Special notes for your reviewers:
Currently, it's only implemented for v1.
If applicable: