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

Allow to specify total memory on agent configuration #4052

Merged
merged 4 commits into from
Mar 28, 2018

Conversation

preetapan
Copy link
Contributor

Fixed up merge conflicts from PR #3778

Allow to set the total memory of an agent in its configuration file. This
can be used in case the automatic detection doesn't work or in specific
environments when memory overcommit (using swap for example) can be
desirable.

Allow to set the total memory of an agent in its configuration file. This
can be used in case the automatic detection doesn't work or in specific
environments when memory overcommit (using swap for example) can be
desirable.
var totalMemory int
cfg := req.Config
if cfg.MemoryMB != 0 {
totalMemory = cfg.MemoryMB * 1024 * 1024
Copy link
Contributor

Choose a reason for hiding this comment

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

Extract into a named constant

return err
var totalMemory int
cfg := req.Config
if cfg.MemoryMB != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would writing a unit test for this make sense?

resp.Resources = &structs.Resources{
MemoryMB: int(memInfo.Total / 1024 / 1024),
MemoryMB: int(totalMemory / 1024 / 1024),
Copy link
Contributor

Choose a reason for hiding this comment

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

Named constant here.

@preetapan preetapan force-pushed the f-specify-total-memory branch from fb822b8 to 09fa5f5 Compare March 28, 2018 16:54
@preetapan preetapan merged commit 6f870b8 into master Mar 28, 2018
@preetapan preetapan deleted the f-specify-total-memory branch March 28, 2018 17:28
@shantanugadgil
Copy link
Contributor

@preetapan

Sorry about digging up old issues, but from: #1480
it seems Docker + swapping has been permanently disabled.

The docs also seem to concur:
https://www.nomadproject.io/docs/drivers/docker.html#memory

So ... is this capability to override the memory value only for exec/raw_exec ?
OR
will this also help while running Docker containers? 😕

@shantanugadgil
Copy link
Contributor

One more link to add to the confusion ... #4091

based on the PR by @tbartelmess I think I see than the docker memory settings will not get any benefit by setting custom memory value of this PR.

@github-actions
Copy link

github-actions bot commented Mar 5, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants