-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[k-NN] Add Clear Cache API #740
[k-NN] Add Clear Cache API #740
Conversation
Codecov Report
@@ Coverage Diff @@
## main #740 +/- ##
============================================
- Coverage 85.03% 84.97% -0.06%
- Complexity 1144 1167 +23
============================================
Files 154 159 +5
Lines 4692 4760 +68
Branches 425 427 +2
============================================
+ Hits 3990 4045 +55
- Misses 509 522 +13
Partials 193 193
|
src/main/java/org/opensearch/knn/plugin/rest/RestClearCacheHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naveentatikonda Here are some of my thoughts:
- Why do we believe doing a flush operation using rest handler is the best way to remove the cache? Can this be done periodically is customer wants?
- What will happen to the search request which are currently running on that index and using that cached graphs?
- Can any user of OpenSearch call this API to clear the cache or there are any restrictions around the usage of the API?
I would recommend creating an issue for this so that different approaches can be discussed around what should be the best approach here.
f373209
to
69b67a9
Compare
Can I get some suggestions on API name something like "Clear k-NN Indices from Memory" or "Evict k-NN Indices from Memory" if we don't want to use the name "Clear Cache API" Also, for the API endpoint should we use Will make the refactoring changes once the API name and endpoint are finalized. |
I think I like this approach (similar to ml-commons for models: https://opensearch.org/docs/latest/ml-commons-plugin/api/#load-model):
I think this centers the APIs around the index/indices resource. With this, I think we could move to deprecating current warmup path:
Would be interested to hear what the rest of the team thinks @navneet1v @vamshin @martin-gaievski |
sounds good to me, both API suggestions and putting existing API to deprecation |
f836fd2
to
22f36a3
Compare
4f167d0
to
01bb6c1
Compare
src/main/java/org/opensearch/knn/plugin/rest/RestClearCacheHandler.java
Outdated
Show resolved
Hide resolved
public static final ClearCacheAction INSTANCE = new ClearCacheAction(); | ||
public static final String NAME = "cluster:admin/clear_cache_action"; | ||
|
||
private ClearCacheAction() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it is private. We will be only using it in this class to create the INSTANCE object.
src/main/java/org/opensearch/knn/plugin/transport/ClearCacheTransportAction.java
Show resolved
Hide resolved
@naveentatikonda can you fix the build issues happening for the mac and ubnutu. |
Signed-off-by: Naveen Tatikonda <[email protected]>
Signed-off-by: Naveen Tatikonda <[email protected]>
Signed-off-by: Naveen Tatikonda <[email protected]>
Signed-off-by: Naveen Tatikonda <[email protected]>
01bb6c1
to
e3e54b1
Compare
Signed-off-by: Naveen Tatikonda <[email protected]>
e3e54b1
to
7d10109
Compare
* @param indexName name of OpenSearch index | ||
* @return NativeMemoryAllocation associated with given index | ||
*/ | ||
public Optional<NativeMemoryAllocation> getIndexMemoryAllocation(String indexName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think our convention is to have params in public methods as final. not a critical though, just for future PRs
I think we can move towards more index based rest endpoints. But I think deprecation of the endpoints and adding new endpoints is out of scope of this PR. |
* Add Clear Cache API Signed-off-by: Naveen Tatikonda <[email protected]> * Add Unit and Integration tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add BWC Tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add CHANGELOG Signed-off-by: Naveen Tatikonda <[email protected]> * Address Review Comments Signed-off-by: Naveen Tatikonda <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> (cherry picked from commit 12f4a51)
* Add Clear Cache API Signed-off-by: Naveen Tatikonda <[email protected]> * Add Unit and Integration tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add BWC Tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add CHANGELOG Signed-off-by: Naveen Tatikonda <[email protected]> * Address Review Comments Signed-off-by: Naveen Tatikonda <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> (cherry picked from commit 12f4a51)
* Add Clear Cache API Signed-off-by: Naveen Tatikonda <[email protected]> * Add Unit and Integration tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add BWC Tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add CHANGELOG Signed-off-by: Naveen Tatikonda <[email protected]> * Address Review Comments Signed-off-by: Naveen Tatikonda <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> (cherry picked from commit 12f4a51) Signed-off-by: Naveen Tatikonda <[email protected]>
* [k-NN] Add Clear Cache API (#740) * Add Clear Cache API Signed-off-by: Naveen Tatikonda <[email protected]> * Add Unit and Integration tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add BWC Tests Signed-off-by: Naveen Tatikonda <[email protected]> * Add CHANGELOG Signed-off-by: Naveen Tatikonda <[email protected]> * Address Review Comments Signed-off-by: Naveen Tatikonda <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> (cherry picked from commit 12f4a51) Signed-off-by: Naveen Tatikonda <[email protected]> * Fix Failing Clear Cache API Test (#1336) Signed-off-by: Naveen Tatikonda <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> Co-authored-by: Naveen Tatikonda <[email protected]>
Description
Add API to flush given k-NN indices out of cache memory.
Issues Resolved
#333
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.