Adding virtual memory pools#21885
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 3485d8a.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
e063aec to
c9c44b9
Compare
PR Reviewer Guide 🔍(Review updated until commit 3995f96)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 3995f96
Previous suggestionsSuggestions up to commit c9c44b9
|
|
❌ Gradle check result for c9c44b9: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
c9c44b9 to
3485d8a
Compare
Signed-off-by: rayshrey <rayshrey@amazon.com>
3485d8a to
3995f96
Compare
|
Persistent review updated to latest commit 3995f96 |
|
❌ Gradle check result for 3995f96: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Unified Native Memory Pool Management
Description
Introduces a unified memory pool registry and elastic rebalancer for all native (off-heap) memory in OpenSearch. All memory pools — Arrow-backed (flight, ingest, query) and Rust virtual
(datafusion, write, merge) — are now managed under a single framework with configurable min/max limits and automatic redistribution.
Key Changes
Unified Pool Registry
NativeAllocatorSPI with virtual pool registration, unified stats, and limit-setting hooksArrowNativeAllocatorPoolGroup(transport, search, indexing, merge) for aggregated customer-facing stats_nodes/stats/native_memoryendpoint — shows grouped pools + jemalloc runtime stats_plugins/arrow_base/statsendpoint — detailed per-pool view with min/max/group for debuggingROOT_LIMIT_SETTING— per-pool limits are the real enforcement (Arrow root set to Long.MAX_VALUE)NativeAllocatorparameter toSearchBackEndPlugin.createComponentsso DataFusion plugin can register its poolElastic Rebalancer
NativeMemoryRebalancer— periodic (5s default) algorithm that grows/shrinks pools based on utilizationsum(effective_limits) <= node.native_memory.limitat all timesRust Memory Pool
MemoryPool+MemoryReservationRAII primitives innative_bridge_commontry_grow(reject) andwait_and_grow(block with timeout + Condvar notification)Settings
native.allocator.rebalancer.enabledtruenative.allocator.rebalance.interval_seconds5native.allocator.pool.{flight,ingest,query}.minnative.allocator.pool.{flight,ingest,query}.maxparquet.native.pool.{write,merge}.minparquet.native.pool.{write,merge}.maxdatafusion.memory_pool_min_bytesdatafusion.memory_pool_limit_bytesValidations
PRESSURE_THRESHOLD > IDLE_THRESHOLDmin >= 1MB,min <= max,max <= 90% of budgetsum(all mins) <= 60% of budgetsum(all maxes) <= budgetwhen rebalancer is disabledbudget > 0andinterval > 0Stats Output
_nodes/stats/native_memory
{ "native_memory": { "total_estimated_bytes": -1, "runtime": { "allocated_bytes": 5476512, "resident_bytes": 15335424 }, "memory_pools": { "transport": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 1866163290 }, "search": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 29858612641 }, "indexing": { "allocated_bytes": 0, "peak_bytes": 303104, "limit_bytes": 4851861264 }, "merge": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 1119697974 } } } }_plugins/arrow_base/stats:
{ "memory_pools": { "runtime": { "allocated_bytes": 5476512, "resident_bytes": 15335424 }, "pools": { "flight": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 1866163290, "min_bytes": 746465316, "group": "transport" }, "query": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 1866163290, "min_bytes": 746465316, "group": "search" }, "datafusion": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 27992449351, "min_bytes": 13809401241, "group": "search" }, "ingest": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 2985861264, "min_bytes": 1492930632, "group": "indexing" }, "write": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 1866163290, "min_bytes": 746465316, "group": "indexing" }, "merge": { "allocated_bytes": 0, "peak_bytes": 0, "limit_bytes": 1119697974, "min_bytes": 373232658, "group": "merge" } } } }