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

[Backport] [2.x] feat: add vertical scaling and SoftReference for snapshot repository data cache (#16489) #16624

Merged

Conversation

reta
Copy link
Collaborator

@reta reta commented Nov 12, 2024

Backport of #16489 to 2.x

…data cache (opensearch-project#16489)

- Applies `SoftReference` to cached repository data for efficient memory management under heap pressure.
- Enables cache size configuration in `opensearch.yml`, adjustable within a range of 500KB to 1% of heap memory.
- Sets the default cache size to `Math.max(ByteSizeUnit.KB.toBytes(500), CACHE_MAX_THRESHOLD / 2)` so it’s generally proportional to heap size. In cases where 1% of the heap is less than 1000KB, indicating a low-memory environment, the default reverts to 500KB as before.
- Since `BytesReference` internally uses `byte[]`, the compressed array size is capped at `Integer.MAX_VALUE - 8` to ensure compatibility with JDK limitations on array sizes. Therefore, the maximum cache size cannot exceed this limit.

Signed-off-by: inpink <[email protected]>
(cherry picked from commit 53d41d3)
Signed-off-by: Andriy Redko <[email protected]>
@reta reta force-pushed the backport/backport-16489-to-2.x branch from 51c75bd to 91fc7ab Compare November 12, 2024 13:13
Copy link
Contributor

❕ Gradle check result for 91fc7ab: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 64.86486% with 13 lines in your changes missing coverage. Please review.

Project coverage is 71.81%. Comparing base (c10488c) to head (91fc7ab).
Report is 5 commits behind head on 2.x.

Files with missing lines Patch % Lines
...ch/repositories/blobstore/BlobStoreRepository.java 64.86% 7 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x   #16624      +/-   ##
============================================
- Coverage     71.87%   71.81%   -0.06%     
+ Complexity    65431    65409      -22     
============================================
  Files          5314     5314              
  Lines        305140   305166      +26     
  Branches      44458    44464       +6     
============================================
- Hits         219311   219159     -152     
- Misses        67507    67772     +265     
+ Partials      18322    18235      -87     

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

@dbwiddis dbwiddis merged commit 0cacc98 into opensearch-project:2.x Nov 12, 2024
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants