Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of cgroup Resource Monitoring in docker

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the example analysis of cgroup resource monitoring in docker, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

1.cgroup terminology parsing:

Blkio: this subsystem sets input / output limits for block devices, such as physical drive devices (including disks, solid state drives, USB, etc.). Cpu: this subsystem uses a scheduler to control task's use of CPU. Cpuacct: this subsystem automatically generates a report on task's use of CPU resources in cgroup. Cpuset: this subsystem allocates separate CPU (in this case for multiprocessor systems) and memory to the task in cgroup. Devices this subsystem can turn on or off task access to the device in cgroup. Freezer this subsystem can suspend or restore task in cgroup. The subsystem of memory can set the memory usage limit of task in cgroup and automatically generate reports on memory resource usage of these task. After using the subsystem of perfevent, the task in cgroup can be tested uniformly. {! [perf: Linux CPU performance probe. For more information, see https://perf.wiki.kernel.org/index.php/MainPage]}*net_cls, which is not used directly. By marking network packets with a level identifier (classid), it allows the Linux flow control program (TC:Traffic Controller) to identify packets generated from a specific cgroup.

two。 Key directory of resource monitoring: cat read out

Memory used:

/ sys/fs/cgroup/memory/docker/ Application ID/memory.usage_in_bytes

Total memory allocated:

/ sys/fs/cgroup/memory/docker/ Application ID/memory.limit_in_bytes

Cpu used: unit nanosecond

/ sys/fs/cgroup/cpuacct/docker/ Application ID/cpuacct.usage

Current cpu of the system:

$cat / proc/stat | grep 'cpu' (cycle / time slice / jiffies) # the sum of the numbers / HZ (cat / boot/config- `time-r` | grep'^ CONFIG_HZ='ubuntu 14.04250) is the system time (seconds) # multiplied by 10 seconds is the system time (nanoseconds)

Examples

$cat / proc/statcpu 432661 13295 86656 422145968 171474 233075 2462 23494 105543694 16586 0 4615cpu1 1119174124 23858 105503820 696997 123 371cpu2 103164 3554 21530 105521167 64032 106 334cpu3 94504153 17772 105577285 21158 4 24intr 1065711094 1057275779 92 06 03527 0352700 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,027,027,027,0000000000000000000000000000000000000000000000000000000000000000000000 The meaning of each parameter (in the first behavior example) of each line of CPU1, CPU2, CPU3 is: parameter interpretation user (432661) accumulates from the start of the system to the current time CPU time in user mode (in jiffies), excluding processes with a Nice value of negative. Nice (13295) accumulated from the start of the system to the current time, the CPU time (in jiffies) system (86656) occupied by the process with a Nice value of negative from the start of the system to the current time, the core time (in jiffies) idle (422145968) accumulated from the start of the system to the current time, and the waiting time except the hard disk IO wait time (unit: jiffies) iowait (171474) accumulated from the start of the system to the current time Hard disk IO wait time (jiffies), irq (233) accumulated from system startup to the current time, hard interrupt time (in jiffies) softirq (5346) accumulated from system startup to current time, soft interrupt time (in jiffies)

Cpu usage: (2 used-1 used) / (system current 2-system current 1) * 100%

The above is all the contents of the article "sample Analysis of cgroup Resource Monitoring in docker". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report