Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguest75 committed Apr 5, 2022
1 parent cb8674e commit 6e8ad60
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 19 deletions.
26 changes: 25 additions & 1 deletion 28_checking_resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Demonstrate how to use various commands to verify resource usage in the OS.


TODO:
* cgroups
* Open sockets
* Free memory
* File handles
Expand All @@ -12,10 +13,33 @@ TODO:
* debugfs
https://github.com/raboof/nethogs


```sh
# booted with
cat /proc/cmdline

# built with
cat /boot/config-5.8.0-49-generic | grep CGROUP

# global limits
systemctl show
```

## Check limits
```sh
ulimit -a
# limits inside a container
docker run -it ubuntu:20.04 /bin/bash -c "ulimit -a"

# limits on host
ulimit -a

# limits for current pid
cat /proc/$$/limits

# show global config
systemctl show
```

## Disk

```sh
Expand Down
59 changes: 41 additions & 18 deletions 34_checking_resources/CGROUPS.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-i-linux-control-groups-and-process

https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-ii-working-linux-containers-lxc
# README
Demonstrate how to work with cgroups

## cgroups
```sh
# man pages
man cgroups

SSH in a cgroup
https://unix.stackexchange.com/questions/209199/how-to-ensure-ssh-via-cgroups-on-centos

https://unix.stackexchange.com/questions/56538/controlling-priority-of-applications-using-cgroups

cgroupsv2
https://unix.stackexchange.com/questions/471476/how-do-i-check-cgroup-v2-is-installed-on-my-machine
# list filesystems and look at cgroups
cat /proc/filesystems

## Limits
docker run -it ubuntu:20.04 /bin/bash -c "ulimit -a"
# see where they a virtually mounted
mount
```

ulimit -a
## Install tooling
```sh
# install tooling
sudo apt install cgroup-tools

cat /proc/$$/limits
# list cgroup tools
dpkg -L cgroup-tools | grep bin

## Cgroups
```sh
cat /proc/filesystems
mount
```

## Walk the filesystem
```sh
# cgroups v1
ls /sys/fs/cgroup/

# cgroups v2
ls /sys/fs/cgroup/unified
```


## Resources
https://medium.com/nttlabs/cgroup-v2-596d035be4d7


https://opensource.com/article/20/10/cgroups

https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-i-linux-control-groups-and-process

https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-ii-working-linux-containers-lxc


SSH in a cgroup
https://unix.stackexchange.com/questions/209199/how-to-ensure-ssh-via-cgroups-on-centos

https://unix.stackexchange.com/questions/56538/controlling-priority-of-applications-using-cgroups

cgroupsv2
https://unix.stackexchange.com/questions/471476/how-do-i-check-cgroup-v2-is-installed-on-my-machine

0 comments on commit 6e8ad60

Please sign in to comment.