opensearch-project / k-NN

🆕 Find the k-nearest neighbors (k-NN) for your vector data
https://opensearch.org/docs/latest/search-plugins/knn/index/
Apache License 2.0
156 stars 123 forks source link

Add quantization state cache #1960

Closed ryanbogan closed 2 months ago

ryanbogan commented 3 months ago

Description

Adds a cache for storing quantization states. This PR contains the cache and tests without integration. In a later PR, this cache will be integrated with a quantization state reader and the query flow.

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.

Vikasht34 commented 3 months ago

Quantization Cache Class Looks good , but we need to improve on unit tests for following test cases

  1. testSingleThreadedAddAndRetrieve 2.testMultiThreadedAddAndRetrieve 3.testMultiThreadedEvict 4.testConcurrentAddAndEvict 5.testCacheClearFromMultipleThreads

Let's have all these tests added.

ryanbogan commented 3 months ago

The most recent commits should address @navneet1v 's comments 1-5. Will add to stats in follow up PR. I also still need to add more unit testing for the new functionality.

ryanbogan commented 3 months ago

There's one flaky test I'm still trying to fix. (edit: should be fixed now)