Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Memory manager #95479
Memory manager #95479
Changes from all commits
4c75be0
48ca6e5
86df524
d0caec9
95f8137
b95d45e
93accb5
9ae499a
711e85a
4a64102
afb1ae3
371c918
abb94be
18c8a82
d7175a8
f7845ed
24be74e
27c5efe
aa63e5a
a015e41
f3d4ac2
606fea2
74eeef2
ff2a110
d0089db
0fa5dd5
b7cfc40
7561a0f
e8ea461
9321340
1021244
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
How does this interact with the
SystemReserved
,KubeReserved
, andQOSReserved
flags? The documentation in the field and flag need to explain it. Can you describe it for me here in a comment so i can review before it gets changed in the code?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.
Hi @smarterclayton ,
Could you provide a reference for
QOSReserved
? (I encounter this term first time)I hope the excerpt from the draft of official documentation helps (notice that the syntax for
--reserved-memory=
is outdated, we will update it in the final doc):Reserved memory flag
Node Allocatable Feature is commonly used by node administrators to reserve K8S node system resources for the kubelet or operating system processes in order to enhance the node stability. A dedicated set of flags can be used for this purpose to set the total amount of reserved memory for a node. This pre-configured value is subsequently utilized to calculate the real amount of node's "allocatable" memory available to pods. Also, K8S scheduler incorporates "allocatable" to optimise pod scheduling process. The foregoing flags include
--kube-reserved
,--system-reserved
and--eviction-threshold
. The sum of their values will account for the total amount of reserved memory.A new
--reserved-memory
flag was added to Memory Manager to allow for this total reserved memory to be split (by a node administrator) and accordingly reserved across many NUMA nodes.Syntax:
--reserved-memory=[{numa-node=int,type=string,limit=string}][,][...]
numa-node
index, e.g.0
type
of memory:memory
- conventional memoryhugepages-2Mi
orhugepages-1Gi
- hugepageslimit
- the amount of reserved memory, e.g.1Gi
Example usage:
--reserved-memory={numa-node=0,type=memory,limit=1Gi},{numa-node=1,type=memory,limit=2Gi}
When you specify values for
--reserved-memory
flag, you must comply with the setting that you prior provided via Node Allocatable Feature flags. That is, the following rule must be obeyed for each memory type:sum(reserved-memory(i)) = kube-reserved + system-reserved + eviction-threshold
,where
i
is an index of a NUMA node.If you do not follow the formula above, the Memory Manager will show an error on startup.
In other words, the example above illustrates that for the conventional memory (
type=memory
), we reserve3Gi
in total, i.e.:sum(reserved-memory(i)) = reserved-memory(0) + reserved-memory(1) = 1Gi + 2Gi = 3Gi
An example of Node Allocatable Feature flags configuration:
--kube-reserved=cpu=500m,memory=50Mi
--system-reserved=cpu=123m,memory=333Mi
--eviction-hard=memory.available<500Mi
NOTICE: hard eviction threshold is not equal to zero by default but
100Mi
, so do not forget to decrease the total amount set via--reserved-memory
by this100Mi
. Otherwise, the Memory Manager will display an error. Here is an example of a correct configuration:Let us validate the configuration above:
kube-reserved + system-reserved + eviction-hard(default) = reserved-memory(0) + reserved-memory(1)
4Gi + 1Gi + 100Mi = 3Gi + 2148Mi
5120Mi + 100Mi = 3072Mi + 2148Mi
5220Mi = 5220Mi
(correct!)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.
Sure, we expect that the following formula must hold for each memory type:
sum(ReservedMemory(i)) = kube-reserved + system-reserved + hard-eviction-threshold
, it means that ifthe total amount of memory defined under the reserved-memory flag should be equal to 1Gi, it can be different combinations, like, reserve all memory from the first NUMA node
--reserved-memory 0:memory=1Gi
or reserve equally from two NUMA nodes--reserved-memory 0:memory=500Mi --reserved-memory 1:memory=500Mi
.Until the documentation PR will be merged we can point to the KEP section, and once it merged I will update the link to point to the documentation(the same way that we have under the CLI flag).
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.