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

Tune default values for ef_search and ef_construction for better indexing and search performance #1353

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

navneet1v
Copy link
Collaborator

@navneet1v navneet1v commented Dec 15, 2023

Description

Changed the default values for ef_search and ef_constrction for enabling better indexing and search latency for vector search

Issues Resolved

#1354

BWC Testing

Manual Testing

Manual Testing was performed by running ./gradlew run on 2.11 branch. After this this script was executed with 2.11 arg.

Once it is completed, I ran the ./gradlew run --preserve-data with updated code. This ensured that old indices are still available and shards are initialized. After this I ran the same script with 2.12 as the parameter.

Automated Testing

Added new BWC test for rolling and restart upgrade to validate index creation and indexing of documents.

In both the testings validated(via logs) that for all the indices the older values of hyper parameters is intact.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

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.

@navneet1v navneet1v changed the title Changed the default values for ef_search and ef_construction for enabling better indexing and search latency for vector search Tuned default values for ef_search and ef_construction for better indexing and search performance Dec 15, 2023
@navneet1v navneet1v force-pushed the change-defaults branch 2 times, most recently from 5b756ad to 1e851ef Compare December 15, 2023 02:00
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (083ea2b) 85.08% compared to head (bc9a6cf) 85.04%.

Files Patch % Lines
...earch/knn/index/util/IndexHyperParametersUtil.java 73.33% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1353      +/-   ##
============================================
- Coverage     85.08%   85.04%   -0.05%     
- Complexity     1242     1251       +9     
============================================
  Files           161      162       +1     
  Lines          5069     5101      +32     
  Branches        473      477       +4     
============================================
+ Hits           4313     4338      +25     
- Misses          551      557       +6     
- Partials        205      206       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@navneet1v navneet1v force-pushed the change-defaults branch 2 times, most recently from 43d992f to 6193214 Compare December 15, 2023 04:57
@navneet1v navneet1v added backport 2.x Enhancements Increases software capabilities beyond original client specifications labels Dec 15, 2023
@navneet1v navneet1v marked this pull request as ready for review December 18, 2023 18:06
@heemin32
Copy link
Collaborator

Do we have test result on recall and latency after the change?

@navneet1v
Copy link
Collaborator Author

Do we have test result on recall and latency after the change?

Yes I have the whole results. I will be updating them on the github issue.

@navneet1v navneet1v changed the title Tuned default values for ef_search and ef_construction for better indexing and search performance Tune default values for ef_search and ef_construction for better indexing and search performance Dec 18, 2023
@navneet1v
Copy link
Collaborator Author

Do we have test result on recall and latency after the change?

@heemin32 Please check the github issue. All the performance benchmarks are updated: #1354

CHANGELOG.md Show resolved Hide resolved
VijayanB
VijayanB previously approved these changes Dec 19, 2023
Copy link
Member

@jmazanec15 jmazanec15 left a comment

Choose a reason for hiding this comment

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

Nice job. This is a very elegant solution. Have a couple questions/comments about some of the implementation details.

@navneet1v
Copy link
Collaborator Author

Keeping this PR open, as me and @jmazanec15 are doing some deep-dive to understand do we need to serialize indexCreatedVersion here:

public MethodComponentContext(StreamInput in) throws IOException {
this.name = in.readString();
// Due to backwards compatibility issue, parameters could be null. To prevent any null pointer exceptions,
// do not read if their are no bytes left is null. Make sure this is in sync with the fellow read method. For
// more information, refer to https://github.com/opensearch-project/k-NN/issues/353.
if (in.available() > 0) {
this.parameters = in.readMap(StreamInput::readString, new ParameterMapValueReader());
} else {
this.parameters = null;
}
}
. Once we have some consensus on that I will move forward with the PR.

@navneet1v navneet1v dismissed stale reviews from naveentatikonda and VijayanB via 080fb9d December 19, 2023 18:53
@navneet1v navneet1v force-pushed the change-defaults branch 2 times, most recently from 080fb9d to bc8ea30 Compare December 19, 2023 20:27
@navneet1v navneet1v force-pushed the change-defaults branch 2 times, most recently from af5c833 to c71dc12 Compare December 20, 2023 18:32
@navneet1v
Copy link
Collaborator Author

Added more integration tests for HNSWPQ where hyper parameters are not set.

@navneet1v navneet1v requested a review from jmazanec15 December 21, 2023 03:27
…exing and search performance

Signed-off-by: Navneet Verma <[email protected]>
Copy link
Member

@jmazanec15 jmazanec15 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ryanbogan ryanbogan left a comment

Choose a reason for hiding this comment

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

LGTM!

@navneet1v navneet1v merged commit feb7968 into opensearch-project:main Dec 21, 2023
48 checks passed
@navneet1v navneet1v deleted the change-defaults branch December 21, 2023 22:00
@navneet1v navneet1v restored the change-defaults branch December 21, 2023 22:00
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 21, 2023
…exing and search performance (#1353)

Signed-off-by: Navneet Verma <[email protected]>
(cherry picked from commit feb7968)
navneet1v added a commit to navneet1v/k-NN that referenced this pull request Dec 21, 2023
navneet1v added a commit that referenced this pull request Dec 22, 2023
…exing and search performance (#1353) (#1362)

Signed-off-by: Navneet Verma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Enhancements Increases software capabilities beyond original client specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants