In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
PouchContainer is an efficient, enterprise-class container engine technology of Alibaba Group, which has the characteristics of strong isolation, high portability and low resource consumption. It can help enterprises to quickly realize the containment of inventory business, and at the same time improve the utilization of physical resources in super-large-scale data centers.
Resource management is an important part of container runtime. This article will introduce the common interfaces of PouchContainer resource management and their corresponding underlying kernel interfaces. In order to deepen readers' understanding, this paper provides test cases for some interfaces.
1. Common APIs for PouchContainer resource management
2. PouchContainer resource management underlying kernel technology 2.1 Memory asset management
2.2 cpu asset management
2.3 io asset management
2.4 other resource management interfaces
3. Detailed explanation and testing method of PouchContainer resource management interface
The following content makes a detailed description of each resource management interface. In order to deepen the reader's understanding, some interfaces provide test cases. The PouchContainer version in the use case is 0.4.0. If the stress command is not available in your image, you can install the stress tool through sudo apt-get install stress.
3.1 Memory asset management 3.1.1-m,-- memory
You can limit the amount of memory used by the container, and the corresponding cgroup file is cgroup/memory/memory.limit_in_bytes.
Unit: bforce, kpene, mpene, g
By default, the container can occupy an unlimited amount of memory until the host memory resources are exhausted.
Run the following command to confirm the cgroup file corresponding to the resource management of the container memory.
# pouch run-ti-- memory 100m reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04 bash-c "cat / sys/fs/cgroup/memory/memory.limit_in_bytes"
104857600
As you can see, when the memory is limited to 100m, the corresponding cgroup file value is 104857600, which is in bytes, that is, 104857600 bytes equals 100m.
The native memory environment is:
# free-m
Total used free shared buff/cache available
Mem: 257755 2557 254234 1 963 254903
Swap: 2047 0 2047
We use the stress tool to verify that the memory limit is in effect. Stress is a stress tool, and the following command will create a process in the container that constantly performs memory-consuming (malloc) and memory-freeing (free) operations. In theory, if the memory consumed is less than the limit, the container will work properly. Note that if you try to use boundary values, that is, if you try to use the stress tool in the container to take up 100m of memory, this operation usually fails because there are other processes running in the container.
The following attempt is made to perform a 150m operation on a container that limits memory usage to 100m, but the container runs normally and there is no OOM.
# pouch run-ti-- memory 100m reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04stress stress-- vm 1-- vm-bytes 150m
Stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
If you look at the memory usage of the system with the following command, you will see that the memory usage of Swap has increased, indicating that the memory option does not limit the amount of memory used by Swap.
# free-m
Total used free shared buff/cache available
Mem: 257755 2676 254114 1 965 254783
Swap: 2047 41 2006
When we try to shut down Swap using the swapoff-a command, we execute the previous command again. As you can see from the following log, an error is triggered when the container's memory usage exceeds the limit.
# pouch run-ti-- memory 100m reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04stress stress-- vm 1-- vm-bytes 150m
Stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
Stress: FAIL: [1] (422) kill error: No such process
Stress: FAIL: [1] (452) failed run completed in 0s
Esses
Stress: FAIL: [1] (422) kill error: No such process
Stress: FAIL: [1] (452) failed run completed in 0s
3.1.2-memory-swap
You can limit the sum of swap partitions and memory used by the container, and the corresponding cgroup file is cgroup/memory/memory.memsw.limit_in_bytes.
Value range: greater than the memory limit
Unit: bforce, kpene, mpene, g
Run the following command to confirm the cgroup file corresponding to the resource management of the container swap partition. As you can see, when memory-swap is limited to 1G, the corresponding cgroup file value is 1073741824, which is in bytes, that is, 1073741824B equals 1G.
# pouch run-ti-m 300m-- memory-swap 1G reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04 bash-c "cat / sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"
1073741824
As shown below, the container encounters an exception when the amount of memory consumed by the attempt exceeds the memory-swap value.
# pouch run-ti-m 100m-- memory-swap 200m reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04stress bash-c "stress-- vm 1-- vm-bytes 300m"
Stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
Stress: FAIL: [1]
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.