Skip to content

Auto-detect available memory when AvailableMemory is unset and apply MaxMemoryPercentage#1756

Open
kushalShukla-web wants to merge 2 commits intohoneycombio:mainfrom
kushalShukla-web:memory_limit
Open

Auto-detect available memory when AvailableMemory is unset and apply MaxMemoryPercentage#1756
kushalShukla-web wants to merge 2 commits intohoneycombio:mainfrom
kushalShukla-web:memory_limit

Conversation

@kushalShukla-web
Copy link

@kushalShukla-web kushalShukla-web commented Nov 30, 2025

Which problem is this PR solving?

When AvailableMemory and MaxAlloc are not set, Refinery has no way to determine its memory limit. This makes configs drift from actual container memory. This PR implements the behavior requested in #1704.

Short description of the changes

  • Auto-detect container memory (via cgroup) when both values are unset
  • Apply MaxMemoryPercentage to compute an effective MaxAlloc
  • Do not require AvailableMemory anymore; keep backwards compatibility
  • Add basic tests for the new fallback logic

…MaxMemoryPercentage.

Signed-off-by: Kushal Shukla <kushalshukla110@gmail.com>
@kushalShukla-web kushalShukla-web requested a review from a team as a code owner November 30, 2025 09:28
@kushalShukla-web
Copy link
Author

kushalShukla-web commented Nov 30, 2025

cc: @seh @VinozzZ

@kushalShukla-web kushalShukla-web changed the title Auto-detect available memory when AvailableMemory is unset and apply … Auto-detect available memory when AvailableMemory is unset and apply MaxMemoryPercentage Nov 30, 2025
Signed-off-by: Kushal Shukla <kushalshukla110@gmail.com>
@VinozzZ
Copy link
Contributor

VinozzZ commented Dec 1, 2025

Thank you for working on the issue.

It looks like the approach in the current PR only supports Linux. We’d like to solve this in a more cross-platform way, ideally leveraging a shared or standard mechanism, rather than maintaining separate, custom implementations per platform.
The team is currently focused on the next minor release, so we won’t be able to take on a larger cross-platform rework right away. That said, we do want to revisit the implementation with portability in mind and would appreciate any ideas or suggestions for a more platform-agnostic solution.

@kushalShukla-web
Copy link
Author

kushalShukla-web commented Dec 8, 2025

in that case can we use something like /proc/meminfo ?

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