Skip to content

Application-server container memory limits#452

Open
june-hua wants to merge 9 commits into
masterfrom
june/container-memory-limits
Open

Application-server container memory limits#452
june-hua wants to merge 9 commits into
masterfrom
june/container-memory-limits

Conversation

@june-hua

Copy link
Copy Markdown
Contributor

To prevent the application-server container from using all of the machine's memory, set a memory limit on the container.

@june-hua june-hua self-assigned this Jul 21, 2026
@june-hua
june-hua force-pushed the june/container-memory-limits branch from 51cfacd to 30fb04f Compare July 22, 2026 15:46
@june-hua
june-hua force-pushed the june/container-memory-limits branch from 30fb04f to 6689d87 Compare July 22, 2026 15:49
@june-hua
june-hua marked this pull request as ready for review July 22, 2026 19:57
@june-hua
june-hua requested review from a team as code owners July 22, 2026 19:57
@june-hua
june-hua requested a review from hyerra July 22, 2026 19:57
@june-hua
june-hua force-pushed the june/container-memory-limits branch from 93e9f38 to af35ce1 Compare July 23, 2026 17:25
echo "First run, initializing container state"
rebuild=true
# Allow override via metadata
MEMORY_LIMIT_OVERRIDE="$(get_metadata_value "memory-limit" "")"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we not want to let the user configure the memory limit? since I believe they can set guest attributes but not always metadata, and we're not triggering a recreate if it changes. that's fine if so, but just wanted to confirm

@june-hua june-hua Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good callout, our naming isn't accurate, set_metadata sets the guest attributes and get_metadata gets the metadata.
Yes we should be using guest attributes, I'm leaning towards removing the MEMORY_LIMIT_OVERRIDE as we do require allocating a certain percentage of memory for system processes and other containers. Thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah I think this is something we can just set ourselves and not let users change

local total_mem_mb=$((total_mem_bytes / 1024 / 1024))

# Reserve memory for host OS, proxy-agent, fluent-bit, and other system processes
# Reserve whichever is larger: 1GB or 10% of total memory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if we could just always reserve 1GB, I don't think the host should be using more than that

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.

2 participants