-
Notifications
You must be signed in to change notification settings - Fork 508
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
Add reference to hybrid mmap extensions setting in k-NN #3262
Conversation
Signed-off-by: Fanit Kolchina <[email protected]>
@martin-gaievski Could you please review this PR for technical accuracy? Also, which versions of the documentation does it make sense to backport this PR to? Thanks! |
Signed-off-by: Fanit Kolchina <[email protected]>
@@ -82,6 +82,12 @@ Take the following steps to improve search performance: | |||
|
|||
If your use case is simply to read the IDs and scores of the nearest neighbors, you can disable reading stored fields, which saves time retrieving the vectors from stored fields. | |||
|
|||
* **Use `mmap` file I/O** | |||
|
|||
For the Lucene-based approximate k-NN search, there is no dedicated cache layer that speeds up read/write operations. Instead, the plugin is relying on the existing caching mechanism in OpenSearch core. In versions 2.4 and below, by default, read/write operations were based on Java NIO, which can be slow depending on the Lucene version and number of segments per shard. Starting with version 2.5, k-NN enables [`mmap`](https://en.wikipedia.org/wiki/Mmap) file I/O by default when the store type is `hybridfs` (the default store type in OpenSearch). This leads to fast file I/O operations and improves the overall performance of both data ingestion and search. The two file extensions specific to vector values that use `mmap` are `.vec` and `.vem`. For more information about these file extensions, see [Lucene documentation](https://lucene.apache.org/core/9_0_0/core/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsFormat.html). |
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.
We probably need to add a note in a passage below that this is only about read/write operations from k-NN and Lucene engine, otherwise it sounds like that whole OpenSearch is using NIO.
In versions 2.4 and below, by default, read/write operations were based on Java NIO, which can be slow depending on the Lucene version and number of segments per shard.
suggested change:
In versions 2.4 and below, by default, read/write operations of Lucene-based approximate k-NN search were based on Java NIO. This can be slow depending on the Lucene version and number of segments per shard.
Signed-off-by: Fanit Kolchina <[email protected]>
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.
LGTM
@@ -82,6 +82,12 @@ Take the following steps to improve search performance: | |||
|
|||
If your use case is simply to read the IDs and scores of the nearest neighbors, you can disable reading stored fields, which saves time retrieving the vectors from stored fields. | |||
|
|||
* **Use `mmap` file I/O** | |||
|
|||
For the Lucene-based approximate k-NN search, there is no dedicated cache layer that speeds up read/write operations. Instead, the plugin is relying on the existing caching mechanism in OpenSearch core. In versions 2.4 and below of the the Lucene-based approximate k-NN search, by default, read/write operations were based on Java NIO, which can be slow depending on the Lucene version and number of segments per shard. Starting with version 2.5, k-NN enables [`mmap`](https://en.wikipedia.org/wiki/Mmap) file I/O by default when the store type is `hybridfs` (the default store type in OpenSearch). This leads to fast file I/O operations and improves the overall performance of both data ingestion and search. The two file extensions specific to vector values that use `mmap` are `.vec` and `.vem`. For more information about these file extensions, see [Lucene documentation](https://lucene.apache.org/core/9_0_0/core/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsFormat.html). |
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.
alternative:
"In Lucene-based approximate k-NN search versions 2.4 and below, read/write operations were based by default on Java NIO ..."
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.
Small typo. Otherwise LGTM.
Co-authored-by: Naarcha-AWS <[email protected]>
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.
@kolchfa-aws Please see my comment and changes and let me know if you have any questions. Thanks!
@@ -82,6 +82,12 @@ Take the following steps to improve search performance: | |||
|
|||
If your use case is simply to read the IDs and scores of the nearest neighbors, you can disable reading stored fields, which saves time retrieving the vectors from stored fields. | |||
|
|||
* **Use `mmap` file I/O** | |||
|
|||
For the Lucene-based approximate k-NN search, there is no dedicated cache layer that speeds up read/write operations. Instead, the plugin is relying on the existing caching mechanism in OpenSearch core. In versions 2.4 and below of the Lucene-based approximate k-NN search, by default, read/write operations were based on Java NIO, which can be slow depending on the Lucene version and number of segments per shard. Starting with version 2.5, k-NN enables [`mmap`](https://en.wikipedia.org/wiki/Mmap) file I/O by default when the store type is `hybridfs` (the default store type in OpenSearch). This leads to fast file I/O operations and improves the overall performance of both data ingestion and search. The two file extensions specific to vector values that use `mmap` are `.vec` and `.vem`. For more information about these file extensions, see [Lucene documentation](https://lucene.apache.org/core/9_0_0/core/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsFormat.html). |
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.
For the Lucene-based approximate k-NN search, there is no dedicated cache layer that speeds up read/write operations. Instead, the plugin is relying on the existing caching mechanism in OpenSearch core. In versions 2.4 and below of the Lucene-based approximate k-NN search, by default, read/write operations were based on Java NIO, which can be slow depending on the Lucene version and number of segments per shard. Starting with version 2.5, k-NN enables [`mmap`](https://en.wikipedia.org/wiki/Mmap) file I/O by default when the store type is `hybridfs` (the default store type in OpenSearch). This leads to fast file I/O operations and improves the overall performance of both data ingestion and search. The two file extensions specific to vector values that use `mmap` are `.vec` and `.vem`. For more information about these file extensions, see [Lucene documentation](https://lucene.apache.org/core/9_0_0/core/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsFormat.html). | |
For the Lucene-based approximate k-NN search, there is no dedicated cache layer that speeds up read/write operations. Instead, the plugin relies on the existing caching mechanism in OpenSearch core. In versions 2.4 and earlier of the Lucene-based approximate k-NN search, read/write operations were based on Java NIO by default, which can be slow, depending on the Lucene version and number of segments per shard. Starting with version 2.5, k-NN enables [`mmap`](https://en.wikipedia.org/wiki/Mmap) file I/O by default when the store type is `hybridfs` (the default store type in OpenSearch). This leads to fast file I/O operations and improves the overall performance of both data ingestion and search. The two file extensions specific to vector values that use `mmap` are `.vec` and `.vem`. For more information about these file extensions, see [the Lucene documentation](https://lucene.apache.org/core/9_0_0/core/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsFormat.html). |
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.
In Stavros' blog on approximate k-NN, it's defined as "approximate k-NN (ANN)". Let's confirm whether we should be using this acronym and, if so, define the term the first time it appears on the page and then use just the acronym thereafter.
|
||
For the Lucene-based approximate k-NN search, there is no dedicated cache layer that speeds up read/write operations. Instead, the plugin is relying on the existing caching mechanism in OpenSearch core. In versions 2.4 and below of the Lucene-based approximate k-NN search, by default, read/write operations were based on Java NIO, which can be slow depending on the Lucene version and number of segments per shard. Starting with version 2.5, k-NN enables [`mmap`](https://en.wikipedia.org/wiki/Mmap) file I/O by default when the store type is `hybridfs` (the default store type in OpenSearch). This leads to fast file I/O operations and improves the overall performance of both data ingestion and search. The two file extensions specific to vector values that use `mmap` are `.vec` and `.vem`. For more information about these file extensions, see [Lucene documentation](https://lucene.apache.org/core/9_0_0/core/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsFormat.html). | ||
|
||
The `mmap` file I/O uses the system file cache rather than memory allocated for Java heap, so no additional allocation is required. To change the default list of extensions set by the plugin, update the `index.store.hybrid.mmap.extensions` setting at the cluster level using the [Cluster Settings API]({{site.url}}{{site.baseurl}}/api-reference/cluster-api/cluster-settings). **Note**: This is an expert-level setting that requires closing the index before updating the setting and reopening it after the update. |
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.
The `mmap` file I/O uses the system file cache rather than memory allocated for Java heap, so no additional allocation is required. To change the default list of extensions set by the plugin, update the `index.store.hybrid.mmap.extensions` setting at the cluster level using the [Cluster Settings API]({{site.url}}{{site.baseurl}}/api-reference/cluster-api/cluster-settings). **Note**: This is an expert-level setting that requires closing the index before updating the setting and reopening it after the update. | |
The `mmap` file I/O uses the system file cache rather than memory allocated for the Java heap, so no additional allocation is required. To change the default list of extensions set by the plugin, update the `index.store.hybrid.mmap.extensions` setting at the cluster level using the [Cluster Settings API]({{site.url}}{{site.baseurl}}/api-reference/cluster-api/cluster-settings). **Note**: This is an expert-level setting that requires closing the index before updating the setting and reopening it after the update. |
Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: Fanit Kolchina <[email protected]>
@martin-gaievski Which versions does this apply to? Thanks! |
All versions starting from 2.5.0 and above. |
* Add reference to hybrid mmap extensions setting in k-NN Signed-off-by: Fanit Kolchina <[email protected]> * Removed extra line Signed-off-by: Fanit Kolchina <[email protected]> * Reworded based on tech review Signed-off-by: Fanit Kolchina <[email protected]> * Update _search-plugins/knn/performance-tuning.md Co-authored-by: Naarcha-AWS <[email protected]> * Implemented editorial comments Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Co-authored-by: Naarcha-AWS <[email protected]> (cherry picked from commit 492c9ec) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add reference to hybrid mmap extensions setting in k-NN Signed-off-by: Fanit Kolchina <[email protected]> * Removed extra line Signed-off-by: Fanit Kolchina <[email protected]> * Reworded based on tech review Signed-off-by: Fanit Kolchina <[email protected]> * Update _search-plugins/knn/performance-tuning.md Co-authored-by: Naarcha-AWS <[email protected]> * Implemented editorial comments Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Co-authored-by: Naarcha-AWS <[email protected]> (cherry picked from commit 492c9ec) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add reference to hybrid mmap extensions setting in k-NN * Removed extra line * Reworded based on tech review * Update _search-plugins/knn/performance-tuning.md * Implemented editorial comments --------- (cherry picked from commit 492c9ec) Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Naarcha-AWS <[email protected]>
* Add reference to hybrid mmap extensions setting in k-NN * Removed extra line * Reworded based on tech review * Update _search-plugins/knn/performance-tuning.md * Implemented editorial comments --------- (cherry picked from commit 492c9ec) Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Naarcha-AWS <[email protected]>
* Add reference to hybrid mmap extensions setting in k-NN Signed-off-by: Fanit Kolchina <[email protected]> * Removed extra line Signed-off-by: Fanit Kolchina <[email protected]> * Reworded based on tech review Signed-off-by: Fanit Kolchina <[email protected]> * Update _search-plugins/knn/performance-tuning.md Co-authored-by: Naarcha-AWS <[email protected]> * Implemented editorial comments Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Co-authored-by: Naarcha-AWS <[email protected]>
…roject#3262) * Add reference to hybrid mmap extensions setting in k-NN Signed-off-by: Fanit Kolchina <[email protected]> * Removed extra line Signed-off-by: Fanit Kolchina <[email protected]> * Reworded based on tech review Signed-off-by: Fanit Kolchina <[email protected]> * Update _search-plugins/knn/performance-tuning.md Co-authored-by: Naarcha-AWS <[email protected]> * Implemented editorial comments Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Co-authored-by: Naarcha-AWS <[email protected]>
Fixes #2886
Checklist
For more information on following Developer Certificate of Origin and signing off your commits, please check here.