-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
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.
client/fingerprint/memory.go
Outdated
var totalMemory int | ||
cfg := req.Config | ||
if cfg.MemoryMB != 0 { | ||
totalMemory = cfg.MemoryMB * 1024 * 1024 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
client/fingerprint/memory.go
Outdated
resp.Resources = &structs.Resources{ | ||
MemoryMB: int(memInfo.Total / 1024 / 1024), | ||
MemoryMB: int(totalMemory / 1024 / 1024), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Named constant here.
fb822b8
to
09fa5f5
Compare
Sorry about digging up old issues, but from: #1480 The docs also seem to concur: So ... is this capability to override the memory value only for exec/raw_exec ? |
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. |
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. |
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.