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 vertical scaling and SoftReference for snapshot repository data cache #16489

Merged
merged 1 commit into from
Nov 12, 2024

Commits on Nov 12, 2024

  1. feat: add vertical scaling and SoftReference for snapshot repository …

    …data cache
    
    - 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]>
    inpink authored and andrross committed Nov 12, 2024
    Configuration menu
    Copy the full SHA
    eeb0be0 View commit details
    Browse the repository at this point in the history