Skip to content

Commit 6e8ad60

Browse files
committed
update
1 parent cb8674e commit 6e8ad60

File tree

2 files changed

+66
-19
lines changed

2 files changed

+66
-19
lines changed

28_checking_resources/README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Demonstrate how to use various commands to verify resource usage in the OS.
33

44

55
TODO:
6+
* cgroups
67
* Open sockets
78
* Free memory
89
* File handles
@@ -12,10 +13,33 @@ TODO:
1213
* debugfs
1314
https://github.com/raboof/nethogs
1415

16+
17+
```sh
18+
# booted with
19+
cat /proc/cmdline
20+
21+
# built with
22+
cat /boot/config-5.8.0-49-generic | grep CGROUP
23+
24+
# global limits
25+
systemctl show
26+
```
27+
1528
## Check limits
1629
```sh
17-
ulimit -a
30+
# limits inside a container
31+
docker run -it ubuntu:20.04 /bin/bash -c "ulimit -a"
32+
33+
# limits on host
34+
ulimit -a
35+
36+
# limits for current pid
37+
cat /proc/$$/limits
38+
39+
# show global config
40+
systemctl show
1841
```
42+
1943
## Disk
2044

2145
```sh

34_checking_resources/CGROUPS.md

+41-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,53 @@
1-
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-i-linux-control-groups-and-process
2-
3-
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-ii-working-linux-containers-lxc
1+
# README
2+
Demonstrate how to work with cgroups
43

4+
## cgroups
5+
```sh
6+
# man pages
7+
man cgroups
58

6-
SSH in a cgroup
7-
https://unix.stackexchange.com/questions/209199/how-to-ensure-ssh-via-cgroups-on-centos
8-
9-
https://unix.stackexchange.com/questions/56538/controlling-priority-of-applications-using-cgroups
10-
11-
cgroupsv2
12-
https://unix.stackexchange.com/questions/471476/how-do-i-check-cgroup-v2-is-installed-on-my-machine
9+
# list filesystems and look at cgroups
10+
cat /proc/filesystems
1311

14-
## Limits
15-
docker run -it ubuntu:20.04 /bin/bash -c "ulimit -a"
12+
# see where they a virtually mounted
13+
mount
14+
```
1615

17-
ulimit -a
16+
## Install tooling
17+
```sh
18+
# install tooling
19+
sudo apt install cgroup-tools
1820

19-
cat /proc/$$/limits
21+
# list cgroup tools
22+
dpkg -L cgroup-tools | grep bin
2023

21-
## Cgroups
22-
```sh
23-
cat /proc/filesystems
24-
mount
2524
```
2625

26+
## Walk the filesystem
2727
```sh
28+
# cgroups v1
2829
ls /sys/fs/cgroup/
30+
31+
# cgroups v2
32+
ls /sys/fs/cgroup/unified
2933
```
3034

35+
36+
## Resources
37+
https://medium.com/nttlabs/cgroup-v2-596d035be4d7
38+
39+
40+
https://opensource.com/article/20/10/cgroups
41+
42+
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-i-linux-control-groups-and-process
43+
44+
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-ii-working-linux-containers-lxc
45+
46+
47+
SSH in a cgroup
48+
https://unix.stackexchange.com/questions/209199/how-to-ensure-ssh-via-cgroups-on-centos
49+
50+
https://unix.stackexchange.com/questions/56538/controlling-priority-of-applications-using-cgroups
51+
52+
cgroupsv2
53+
https://unix.stackexchange.com/questions/471476/how-do-i-check-cgroup-v2-is-installed-on-my-machine

0 commit comments

Comments
 (0)