Skip to content
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

Merged
merged 6 commits into from
Mar 16, 2023

Conversation

kolchfa-aws
Copy link
Collaborator

Fixes #2886

Checklist

  • [x ] By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@kolchfa-aws kolchfa-aws requested a review from a team as a code owner March 7, 2023 16:31
@kolchfa-aws kolchfa-aws self-assigned this Mar 7, 2023
@kolchfa-aws
Copy link
Collaborator Author

@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).
Copy link
Member

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]>
Copy link
Contributor

@cwillum cwillum left a 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).
Copy link
Contributor

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 ..."

Copy link
Collaborator

@Naarcha-AWS Naarcha-AWS left a 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.

_search-plugins/knn/performance-tuning.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@natebower natebower left a 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).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).

Copy link
Collaborator

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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]>
@kolchfa-aws
Copy link
Collaborator Author

@martin-gaievski Which versions does this apply to? Thanks!

@martin-gaievski
Copy link
Member

@martin-gaievski Which versions does this apply to? Thanks!

All versions starting from 2.5.0 and above.

@kolchfa-aws kolchfa-aws added backport 2.5 PR: Backport label for 2.5 backport 2.6 PR: Backport label for 2.6 labels Mar 16, 2023
@kolchfa-aws kolchfa-aws merged commit 492c9ec into main Mar 16, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 16, 2023
* 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>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 16, 2023
* 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>
kolchfa-aws pushed a commit that referenced this pull request Mar 16, 2023
* 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]>
kolchfa-aws pushed a commit that referenced this pull request Mar 16, 2023
* 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]>
vagimeli pushed a commit that referenced this pull request May 4, 2023
* 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]>
vagimeli added a commit that referenced this pull request May 4, 2023
vagimeli added a commit that referenced this pull request May 4, 2023
vagimeli added a commit that referenced this pull request May 4, 2023
harshavamsi pushed a commit to harshavamsi/documentation-website that referenced this pull request Oct 31, 2023
…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]>
@kolchfa-aws kolchfa-aws deleted the mmap-extensions-knn branch March 28, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.5 PR: Backport label for 2.5 backport 2.6 PR: Backport label for 2.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DOC] k-NN plugin: add reference to hybrid mmap extensions setting under performance tunning
5 participants