Add runtime.memory_limit config parameter #537
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#537
Loading…
Reference in a new issue
No description provided.
Delete branch "dstepanov-yadro/frostfs-node:fix/memlimit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This parameter allows to set soft memory limit for Go runtime's GC. It can be useful for GC to work more aggressively in the case when the amount of memory occupied is close to the amount of RAM in the system.
This value can also be set via
GOMEMLIMIT
environment variable , but I put it in the config for several reasons:c511716000
to1ee2f68038
I am ok with this PR, as long as we agree to support it like this across all our stack.
@alexvanin @realloc @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-core-committers
My concerns (the 3rd is the biggest one):
GOMEMLIMIT
looks nice somewhere near. It seems we lose this possibility in the current implementation: missing value is interpreted as "ignore everything and disable the limit". I believe this is unexpected for the user and should be changed (also it is uniform with 4, if we do not support it).One of the benefits I see is the ability to have more clever options in future (like
memory_limit: adaptive
ref #106) or to have simple settings for a combination of parameters (likestorage.lowmem: true
which is used in a number of places).@ -429,0 +433,4 @@
```yaml
runtime:
memory_limit: 1GB
I think memory limit is misleading (no one reads the docs), can we add
soft_
?ok, fixed
@ -493,4 +493,5 @@ const (
FrostFSNodeNodeIsUnderMaintenanceSkipInitialBootstrap = "the node is under maintenance, skip initial bootstrap"
EngineCouldNotChangeShardModeToDisabled = "could not change shard mode to disabled"
NetmapNodeAlreadyInCandidateListOnlineSkipInitialBootstrap = "the node is already in candidate list with online state, skip initial bootstrap"
RuntimeMemoryLimitUpdated = "runtime memory limit value updated"
And here too
fixed
1ee2f68038
to7573346869
GOMEMLIMIT
environment parameter. In addition, this environment variable is only available from version 1.19 of the Go language. Speaking generally, I would consider the case you described using an undocumented feature at my own risk.GOGC
, I would suggest runtime.memory_free_frequency or so on.pprof
section, because theypprof
related, i think.Proposal looks good for me and we can support the same configuration in protocol gates.
Although I would rather keep support of the GO environment variables. While users don't know about Go in the backend, as a developer I expect
GOMEMLIMIT
to work the same regardless of the application configuration.7573346869
toa2c9e813c7
Agree, fixed
@ -429,0 +438,4 @@
| Parameter | Type | Default value | Description |
|---------------------|--------|---------------|--------------------------------------------------------------------------|
| `soft_memory_limit` | `size` | 0 | Soft memory limit for the runtime. Zero or no value stands for no limit. |
Can we also mention that
GOMEMLIMIT
has more priority?Done
a2c9e813c7
to805a4b3fae
805a4b3fae
to588370e34a
@ -0,0 +11,4 @@
memoryLimitDefault = math.MaxInt64
)
// GCMemoryLimitBytes returns the value of "memory_limit" config parameter from "runtime" section.
Also
soft
here.fixed
588370e34a
to32c77f3a23