Conversation
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Summary of ChangesHello, 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 robust and configurable L2 eviction system, enabling individual L2 adapters to manage their storage capacity effectively. It refactors the eviction policy framework to be more modular and extensible, clearly separating core eviction logic from the cache tier-specific event handling. The changes ensure that L2 adapters can actively participate in the cache's lifecycle by reporting usage and responding to eviction commands, thereby improving overall cache efficiency and resource management. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new L2 eviction mechanism, mirroring the existing L1 eviction. Key changes include defining an L2AdapterListener interface for L2 adapter events, refactoring EvictionPolicy into a pure abstract base class with L1EvictionPolicy and L2EvictionPolicy subclasses to bridge events, and implementing delete() and get_usage() methods in L2 adapters (MockL2Adapter, NixlStoreL2Adapter, FSL2Adapter, NativeConnectorL2Adapter). A new L2EvictionController is added to manage L2 eviction based on adapter usage and configured policies, and the StorageManager is updated to instantiate these L2 controllers per adapter. Review comments highlight several improvement opportunities: ensuring the EvictionController base class calls super().__init__(), enhancing ValueError messages with available options, including exception information in log messages for better debugging, delegating L1ManagerListener implementations to the eviction policy, clarifying the naming of the L1 eviction controller, and adding a missing assertion in a test case to verify storage pool slot release.
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
ApostaC
left a comment
There was a problem hiding this comment.
Main comment on the overall design: let's have a unified L2 eviction controller, not one per L2 adapter
Other things:
- Let's avoid multi inheritance
- The eviction controller don't need to extend the "Listener" interface, because they do not need to be aware of the exact key access/insertion/deletion, but only the memory usage information. Only the eviction policy need to extend the listener interface to monitor the accesses of keys.
| policy: StorePolicy, | ||
| ) -> None: | ||
| super().__init__(l1_manager) | ||
| self._l1_manager = l1_manager |
There was a problem hiding this comment.
Same question, what's the issue with using super().__init__?
There was a problem hiding this comment.
Because l2 eviction controller does not need to hold a reference to l1_manager for now.
| def delete(self, keys: list[ObjectKey]) -> None: | ||
| # Not implemented for the native connector adapter. | ||
| pass | ||
|
|
||
| def get_usage(self) -> tuple[float, float]: | ||
| # Not implemented for the native connector adapter. | ||
| return (0.0, 0.0) | ||
|
|
There was a problem hiding this comment.
cc @sammshen , we may need to consider supporting eviction in the native L2 adapter
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
ApostaC
left a comment
There was a problem hiding this comment.
just nit comments, otherwise LGTM!
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
* add l2 eviction Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * add docs Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix observability Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix l2-related tests Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * add minor changes Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix return val confusion Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix comments Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * add unit tests Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * improve according on comments Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> --------- Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
* add l2 eviction Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * add docs Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix observability Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix l2-related tests Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * add minor changes Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix return val confusion Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * fix comments Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * add unit tests Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> * improve according on comments Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn> --------- Signed-off-by: YaoJiayi <120040070@link.cuhk.edu.cn>
What this PR does / why we need it:
Special notes for your reviewers:
If applicable: