Closed zhuochengs closed 4 years ago
This isn't a Kubernetes or MariaDB forum but I'll give it my best
innodb_buffer_pool_size
isn't the same thing as container memory, it occupies memory but there's still other operations/processes that can consume memory.
Staying under 70% of the pod's request is a best practice to not go oom. You're setting 70% of that as the baseline. But actually it's more than that because the calculation that MariaDB uses for the innodb_buffer_pool_size
is performed in chunks. https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html
Chunk size is defined by the
innodb_buffer_pool_chunk_size
configuration option, which has a default of 128M. For more information, see Configuring InnoDB Buffer Pool Chunk Size.Buffer pool size must always be equal to or a multiple of
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
. If you configureinnodb_buffer_pool_size
to a value that is not equal to or a multiple ofinnodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
, buffer pool size is automatically adjusted to a value that is equal to or a multiple ofinnodb_buffer_pool_chunk_size
*innodb_buffer_pool_instances
.
Also Kubernetes resource requests are just information for the kube-scheduler to fit the pod appropriately, it doesn't actually bestow the pod with a set amount of memory, it's just a number meant to represent how much that pod should use as an average which is completely subjective to its average workload. Then the limit will actually restrict the amount of memory the pod will use, it actually implements a memory_limit
on the container (different depending on your container runtime) https://docs.docker.com/engine/docker-overview/#control-groups
For further questions you should ask a Kubernetes/MariaDB resource/forum or Stack Overflow.
Thanks a lot! @wglambert !
Hi I have a question: the configration of innodb_buffer_pool_size in k8s. I have a node in k8s, and this node have 125 GBs memory and 112 cpus(logic). now I deploy the mariadb pod on this node, and it's my resource configration like that:
and then I saw some log says that do not set the pod's memory over the request's memory*70%, so I set the configration like that:
innodb_buffer_pool_size = 56000M
But now I find the mariadb's pod's memory increased very fast, it almost above the 56000M.
So I want know, if I want my mariadb's pod use memory as much as possible in this db-node, how to set the right configration, about the k8s request 、limit resource( CPU and memory), and the mariadb innodb_buffer_pool_size ? Thanks!
ps: this is my current configration about mariadb: