Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
elearning:workbooks:debian:10:junior:l120 [2024/03/08 08:46] – admin | elearning:workbooks:debian:10:junior:l120 [2024/10/16 12:02] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 61: | Ligne 61: | ||
* Limiter les Ressources | * Limiter les Ressources | ||
* LAB #4 - ulimit | * LAB #4 - ulimit | ||
- | * LAB #5 - cgroups | + | * LAB #5 - cgroups |
- | * 5.1 - Préparation | + | * 5.1 - Présentation |
- | * 5.2 - Présentation | + | * 5.2 - Limitation de la CPU |
- | * 5.3 - Limitation de la Mémoire | + | * 5.3 - La Commande systemctl set-property |
- | * 5.4 - La Commande cgcreate | + | |
- | * 5.5 - La Commande cgdelete | + | |
- | * 5.6 - Le Fichier / | + | |
- | * 5.7 - La Commande cgconfigparser | + | |
- | * LAB #6 - cgroups v2 | + | |
- | * 6.1 - Préparation | + | |
- | * 6.2 - Présentation | + | |
- | * 6.3 - Limitation de la CPU | + | |
- | * 6.4 - La Commande systemctl set-property | + | |
=====Présentation des Fichiers Spéciaux===== | =====Présentation des Fichiers Spéciaux===== | ||
Ligne 3350: | Ligne 3341: | ||
</ | </ | ||
- | ====LAB #5 - cgroups | + | ====LAB #5 - cgroups |
- | === 5.1 - Préparation=== | + | ===5.1 - Présentation=== |
- | + | ||
- | Debian 11 utilise cgroups v2 par défault. Pour revenir à l' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | # If you change this file, run ' | + | |
- | # / | + | |
- | # For full documentation of the options in this file, see: | + | |
- | # info -f grub -n ' | + | |
- | + | ||
- | GRUB_DEFAULT=0 | + | |
- | GRUB_TIMEOUT=5 | + | |
- | GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` | + | |
- | GRUB_CMDLINE_LINUX_DEFAULT=" | + | |
- | GRUB_CMDLINE_LINUX="" | + | |
- | + | ||
- | # Uncomment to enable BadRAM filtering, modify to suit your needs | + | |
- | # This works with Linux (no patch required) and with any kernel that obtains | + | |
- | # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) | + | |
- | # | + | |
- | + | ||
- | # Uncomment to disable graphical terminal (grub-pc only) | + | |
- | # | + | |
- | + | ||
- | # The resolution used on graphical terminal | + | |
- | # note that you can use only modes which your graphic card supports via VBE | + | |
- | # you can see them in real GRUB with the command `vbeinfo' | + | |
- | # | + | |
- | + | ||
- | # Uncomment if you don't want GRUB to pass " | + | |
- | # | + | |
- | + | ||
- | # Uncomment to disable generation of recovery mode menu entries | + | |
- | # | + | |
- | + | ||
- | # Uncomment to get a beep at grub start | + | |
- | # | + | |
- | + | ||
- | root@debian11: | + | |
- | Generating grub configuration file ... | + | |
- | Found background image: / | + | |
- | Found linux image: / | + | |
- | Found initrd image: / | + | |
- | done | + | |
- | </ | + | |
- | + | ||
- | Redémarrez ensuite votre VM : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | === 5.2 - Présentation=== | + | |
- | + | ||
- | Les **Groupes de Contrôles** (//Control Groups//) aussi appelés **CGroups**, | + | |
- | + | ||
- | Les groupes de contrôle sont organisés de manière hiérarchique, | + | |
- | + | ||
- | Ces hiérarchies multiples et séparés sont necéssaires parce que chaque hiérarchie est attaché à un ou plusieurs **sous-système(s)** aussi appelés des **Contrôleurs de Ressources** ou simplement des **Contrôleurs**. Les contrôleurs disponibles sous Debian 11 sont : | + | |
- | + | ||
- | * **blkio** - utilisé pour établir des limites sur l' | + | |
- | * **cpu** - utilisé pour fournir aux tâches des groupes de contrôle accès au CPU grâce au planificateur, | + | |
- | * **cpuacct** - utilisé pour produire des rapports automatiques sur les ressources CPU utilisées par les tâches dans un groupe de contrôle, | + | |
- | * **cpuset** - utilisé pour assigner des CPU individuels sur un système multicoeur et des noeuds de mémoire à des tâches dans un groupe de contrôle, | + | |
- | * **devices** - utilisé pour autoriser ou pour refuser l' | + | |
- | * **freezer** - utilisé pour suspendre ou pour réactiver les tâches dans un groupe de contrôle, | + | |
- | * **memory** - utilisé pour établir les limites d' | + | |
- | * **net_cls** - utilisé pour repèrer les paquets réseau avec un identifiant de classe (// | + | |
- | * **perf_event** | + | |
- | * **hugetlb** - utilisé pour limiter des ressources sur des pages de mémoire virtuelle de grande taille. | + | |
- | + | ||
- | Il est à noter que : | + | |
- | + | ||
- | * chaque processus du système appartient à un cgroup et seulement à un cgroup à la fois, | + | |
- | * tous les threads d'un processus appartiennent au même cgroup, | + | |
- | * à la création d'un processus, celui-ci est mis dans le même cgroup que son processus parent, | + | |
- | * un processus peut être migré d'un cgroup à un autre cgroup. Par contre, la migration d'un processus n'a pas d' | + | |
- | + | ||
- | Commencez par installer le paquet **cgroup-tools** : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | Pour visualiser les hiérarchies, | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | cpuset / | + | |
- | cpu,cpuacct / | + | |
- | blkio / | + | |
- | memory / | + | |
- | devices / | + | |
- | freezer / | + | |
- | net_cls, | + | |
- | perf_event / | + | |
- | hugetlb / | + | |
- | pids / | + | |
- | rdma / | + | |
- | </ | + | |
- | + | ||
- | Sous Debian 11, **Systemd** organise les processus dans chaque CGroup. Par exemple tous les processus démarrés par le serveur Apache se trouveront dans le même CGroup, y compris les scripts CGI. Ceci implique que la gestion des ressources en utilisant des hiérarchies est couplé avec l' | + | |
- | + | ||
- | En haut de l' | + | |
- | + | ||
- | * le **system.slice** - l' | + | |
- | * le **user.slice** - l' | + | |
- | * le **machine.slice** - l' | + | |
- | + | ||
- | En dessous des tranches peuvent se trouver : | + | |
- | + | ||
- | * des **scopes** - des processus crées par **fork**, | + | |
- | * des **services** - des processus créés par une **Unité**. | + | |
- | + | ||
- | Les slices peuvent être visualisés avec la commande suivante : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | UNIT | + | |
- | -.slice | + | |
- | system-getty.slice | + | |
- | system-lvm2\x2dpvscan.slice | + | |
- | system-modprobe.slice | + | |
- | system-systemd\x2dcryptsetup.slice loaded active active Cryptsetup Units Slice | + | |
- | system.slice | + | |
- | user-1000.slice | + | |
- | user.slice | + | |
- | + | ||
- | LOAD = Reflects whether the unit definition was properly loaded. | + | |
- | ACTIVE = The high-level unit activation state, i.e. generalization of SUB. | + | |
- | SUB = The low-level unit activation state, values depend on unit type. | + | |
- | 8 loaded units listed. Pass --all to see loaded but inactive units, too. | + | |
- | To show all installed unit files use ' | + | |
- | </ | + | |
- | + | ||
- | L' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | Control group /: | + | |
- | -.slice | + | |
- | ├─user.slice | + | |
- | │ └─user-1000.slice | + | |
- | │ | + | |
- | │ │ ├─app.slice | + | |
- | │ │ │ ├─pulseaudio.service | + | |
- | │ │ │ │ └─974 / | + | |
- | │ │ │ ├─pipewire.service | + | |
- | │ │ │ │ ├─973 / | + | |
- | │ │ │ │ └─984 / | + | |
- | │ │ │ └─dbus.service | + | |
- | │ │ │ | + | |
- | │ │ └─init.scope | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ │ ├─ 993 sshd: trainee [priv] | + | |
- | │ │ ├─ 999 sshd: trainee@pts/ | + | |
- | │ │ ├─1000 -bash | + | |
- | │ │ ├─1003 su - | + | |
- | │ │ ├─1004 -bash | + | |
- | │ │ ├─1010 systemd-cgls | + | |
- | │ │ └─1011 less | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | ├─init.scope | + | |
- | │ └─1 / | + | |
- | └─system.slice | + | |
- | ├─apache2.service | + | |
- | │ ├─595 / | + | |
- | │ ├─597 / | + | |
- | │ └─598 / | + | |
- | ├─systemd-udevd.service | + | |
- | │ └─317 / | + | |
- | ├─cron.service | + | |
- | │ └─491 / | + | |
- | ├─polkit.service | + | |
- | │ └─495 / | + | |
- | ├─rtkit-daemon.service | + | |
- | │ └─979 / | + | |
- | ├─auditd.service | + | |
- | │ └─460 / | + | |
- | ├─wpa_supplicant.service | + | |
- | │ └─498 / | + | |
- | ├─ModemManager.service | + | |
- | │ └─515 / | + | |
- | ├─inetd.service | + | |
- | │ └─694 / | + | |
- | ├─systemd-journald.service | + | |
- | │ └─296 / | + | |
- | ├─mdmonitor.service | + | |
- | │ └─432 /sbin/mdadm --monitor --scan | + | |
- | ├─ssh.service | + | |
- | │ └─580 sshd: / | + | |
- | lines 1-58 | + | |
- | [q] | + | |
- | </ | + | |
- | + | ||
- | En utilisant Systemd, plusieurs ressources peuvent être limitées : | + | |
- | + | ||
- | * **CPUShares** - par défault 1024, | + | |
- | * **MemoryLimit** - limite exprimée en Mo ou en Go. Pas de valeur par défaut, | + | |
- | * **BlockIOWeight** - valeur entre 10 et 1000. Pas de valeur par défaut, | + | |
- | * **StartupCPUShares** - comme CPUShares mais uniquement appliqué pendant le démarrage, | + | |
- | * **StartupBlockIOWeight** - comme BlockIOWeight mais uniquement appliqué pendant le démarrage, | + | |
- | * **CPUQuota** - utilisé pour limiter le temps CPU, même quand le système ne fait rien. | + | |
- | + | ||
- | === 5.3 - Limitation de la Mémoire=== | + | |
- | + | ||
- | Commencez par créer le script **hello-world.sh** qui servira à générer un processus pour travailler avec les CGroups : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | # | + | |
- | while [ 1 ]; do | + | |
- | echo "hello world" | + | |
- | sleep 360 | + | |
- | done | + | |
- | </ | + | |
- | + | ||
- | Rendez le script exécutable et testez-le : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | hello world | + | |
- | ^C | + | |
- | </ | + | |
- | + | ||
- | Créez maintenant un CGroup dans le sous-système **memory** appelé **helloworld** : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | Par défaut, ce CGroup héritera de l' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | 39997440 | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important > | + | |
- | **Important** - Notez que les 40 000 000 demandés sont devenus 39 997 440 ce qui correspond à un nombre entier de pages mémoire du noyau de 4Ko. ( 39 997 440 / 4096 = 9 765 ). | + | |
- | </ | + | |
- | + | ||
- | Lancez maintenant le script **helloworld.sh** : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | [1] 1073 | + | |
- | root@debian11: | + | |
- | [Entrée] | + | |
- | + | ||
- | root@debian11: | + | |
- | root 1073 0.0 0.0 | + | |
- | root 1077 0.0 0.0 | + | |
- | </ | + | |
- | + | ||
- | Notez qu'il n'y a pas de limite de la mémoire, ce qui implique l' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | CGROUP | + | |
- | 8: | + | |
- | </ | + | |
- | + | ||
- | Insérer le PID de notre script dans le CGroup **helloworld** : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | Notez maintenant l' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | CGROUP | + | |
- | 8: | + | |
- | </ | + | |
- | + | ||
- | Constatez ensuite l' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | 274432 | + | |
- | </ | + | |
- | + | ||
- | Tuez le script **hello-world.sh** : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | root 1086 0.0 0.0 | + | |
- | [1]+ Terminated | + | |
- | </ | + | |
- | + | ||
- | Créez un second CGroup beaucoup plus restrictif : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | 4096 | + | |
- | </ | + | |
- | + | ||
- | Relancez le script **hello-world.sh** et insérez-le dans le nouveau CGroup : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | [1] 1089 | + | |
- | + | ||
- | root@debian11: | + | |
- | [Entrée] | + | |
- | + | ||
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | Attendez la prochaine sortie de **hello world** sur le canal standard puis constatez que le script s' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root 1100 0.0 0.0 | + | |
- | [1]+ Killed | + | |
- | </ | + | |
- | + | ||
- | Notez la trace dans le fichier **/ | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012423] workingset_nodereclaim 0 | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012423] pgfault 0 | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012423] pgmajfault 0 | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012423] pgrefill 0 | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012423] pgscan 0 | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012423] pgsteal 0 | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012425] Tasks state (memory values in pages): | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012426] [ pid ] | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012428] [ | + | |
- | May 4 06:44:43 debian11 kernel: [ 994.012430] oom-kill: | + | |
- | </ | + | |
- | + | ||
- | ===5.4 - La Commande cgcreate=== | + | |
- | + | ||
- | Cette commande permet la création d'un CGroup : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | + | ||
- | root@debian11: | + | |
- | total 0 | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 cgroup.clone_children | + | |
- | --w--w--w- 1 root root 0 May 4 06:47 cgroup.event_control | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 cgroup.procs | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.failcnt | + | |
- | --w------- 1 root root 0 May 4 06:47 memory.force_empty | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.kmem.failcnt | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.kmem.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.kmem.max_usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.kmem.slabinfo | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.kmem.tcp.failcnt | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.kmem.tcp.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.kmem.tcp.max_usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.kmem.tcp.usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.kmem.usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.max_usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.memsw.failcnt | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.memsw.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.memsw.max_usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.memsw.usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.move_charge_at_immigrate | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.numa_stat | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.oom_control | + | |
- | ---------- 1 root root 0 May 4 06:47 memory.pressure_level | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.soft_limit_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.stat | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.swappiness | + | |
- | -r--r--r-- 1 root root 0 May 4 06:47 memory.usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 memory.use_hierarchy | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 notify_on_release | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:47 tasks | + | |
- | </ | + | |
- | + | ||
- | Il n' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | ===5.5 - La Commande cgexec=== | + | |
- | + | ||
- | Cette commande permet d' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | [1] 1106 | + | |
- | + | ||
- | root@debian11: | + | |
- | [Entrée] | + | |
- | + | ||
- | root@debian11: | + | |
- | 1106 | + | |
- | 1107 | + | |
- | root@debian11: | + | |
- | root 1106 0.0 0.0 | + | |
- | root 1107 0.0 0.0 | + | |
- | root 1108 0.0 0.0 0 0 ? I 06:49 0:00 [kworker/ | + | |
- | root 1113 0.0 0.0 | + | |
- | </ | + | |
- | + | ||
- | ===5.6 - La Commande cgdelete== | + | |
- | + | ||
- | Une fois le script terminé, cette commande permet de supprimer le cgroup : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | root 1107 0.0 0.0 | + | |
- | root 1108 0.0 0.0 0 0 ? I 06:49 0:00 [kworker/ | + | |
- | root 1115 0.0 0.0 | + | |
- | [1]+ Terminated | + | |
- | + | ||
- | root@debian11: | + | |
- | + | ||
- | root@debian11: | + | |
- | ls: cannot access '/ | + | |
- | </ | + | |
- | + | ||
- | ===5.7 - Le Fichier / | + | |
- | + | ||
- | Afin de les rendre persistants, | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | group helloworld2 { | + | |
- | cpu { | + | |
- | cpu.shares = 100; | + | |
- | } | + | |
- | memory { | + | |
- | memory.limit_in_bytes = 40000; | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important > | + | |
- | **Important** - Notez la création de **deux** limitations, | + | |
- | </ | + | |
- | + | ||
- | Créez donc les deux CGroups concernés : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | + | ||
- | root@debian11: | + | |
- | total 0 | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 cgroup.clone_children | + | |
- | --w--w--w- 1 root root 0 May 4 06:53 cgroup.event_control | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 cgroup.procs | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.failcnt | + | |
- | --w------- 1 root root 0 May 4 06:53 memory.force_empty | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.kmem.failcnt | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.kmem.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.kmem.max_usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.kmem.slabinfo | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.kmem.tcp.failcnt | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.kmem.tcp.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.kmem.tcp.max_usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.kmem.tcp.usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.kmem.usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.max_usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.memsw.failcnt | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.memsw.limit_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.memsw.max_usage_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.memsw.usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.move_charge_at_immigrate | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.numa_stat | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.oom_control | + | |
- | ---------- 1 root root 0 May 4 06:53 memory.pressure_level | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.soft_limit_in_bytes | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.stat | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.swappiness | + | |
- | -r--r--r-- 1 root root 0 May 4 06:53 memory.usage_in_bytes | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 memory.use_hierarchy | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 notify_on_release | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:53 tasks | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | + | ||
- | root@debian11: | + | |
- | total 0 | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 cgroup.clone_children | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 cgroup.procs | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.stat | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 cpuacct.usage | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.usage_all | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.usage_percpu | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.usage_percpu_sys | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.usage_percpu_user | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.usage_sys | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpuacct.usage_user | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 cpu.cfs_period_us | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 cpu.cfs_quota_us | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 cpu.shares | + | |
- | -r--r--r-- 1 root root 0 May 4 06:54 cpu.stat | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 notify_on_release | + | |
- | -rw-r--r-- 1 root root 0 May 4 06:54 tasks | + | |
- | </ | + | |
- | + | ||
- | ===5.8 - La Commande cgconfigparser=== | + | |
- | + | ||
- | Appliquez le contenu du fichier **/ | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | + | ||
- | root@debian11: | + | |
- | 36864 | + | |
- | + | ||
- | root@debian11: | + | |
- | 100 | + | |
- | </ | + | |
- | + | ||
- | ====LAB #6 - cgroups v2==== | + | |
- | + | ||
- | ===6.1 - Préparation=== | + | |
- | + | ||
- | Pour revenir à l' | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | root@debian11: | + | |
- | # If you change this file, run ' | + | |
- | # / | + | |
- | # For full documentation of the options in this file, see: | + | |
- | # info -f grub -n ' | + | |
- | + | ||
- | GRUB_DEFAULT=0 | + | |
- | GRUB_TIMEOUT=5 | + | |
- | GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` | + | |
- | GRUB_CMDLINE_LINUX_DEFAULT=" | + | |
- | GRUB_CMDLINE_LINUX="" | + | |
- | + | ||
- | # Uncomment to enable BadRAM filtering, modify to suit your needs | + | |
- | # This works with Linux (no patch required) and with any kernel that obtains | + | |
- | # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) | + | |
- | # | + | |
- | + | ||
- | # Uncomment to disable graphical terminal (grub-pc only) | + | |
- | # | + | |
- | + | ||
- | # The resolution used on graphical terminal | + | |
- | # note that you can use only modes which your graphic card supports via VBE | + | |
- | # you can see them in real GRUB with the command `vbeinfo' | + | |
- | # | + | |
- | + | ||
- | # Uncomment if you don't want GRUB to pass " | + | |
- | # | + | |
- | + | ||
- | # Uncomment to disable generation of recovery mode menu entries | + | |
- | # | + | |
- | + | ||
- | # Uncomment to get a beep at grub start | + | |
- | # | + | |
- | + | ||
- | root@debian11: | + | |
- | Generating grub configuration file ... | + | |
- | Found background image: / | + | |
- | Found linux image: / | + | |
- | Found initrd image: / | + | |
- | done | + | |
- | </ | + | |
- | + | ||
- | Redémarrez ensuite votre VM : | + | |
- | + | ||
- | < | + | |
- | root@debian11: | + | |
- | </ | + | |
- | + | ||
- | ===6.2 | + | |
A l' | A l' | ||
Ligne 4072: | Ligne 3473: | ||
</ | </ | ||
- | ===6.3 - Limitation de la CPU=== | + | ===5.2 - Limitation de la CPU=== |
Il existe deux façons de limiter les ressources de la CPU : | Il existe deux façons de limiter les ressources de la CPU : | ||
Ligne 4348: | Ligne 3749: | ||
</ | </ | ||
- | ===6.4 - La Commande systemctl set-property=== | + | ===5.3 - La Commande systemctl set-property=== |
Comme déjà vu, systemd organise les processus dans des **slices**, par exemple les utilisateurs sont regroupés dans **/ | Comme déjà vu, systemd organise les processus dans des **slices**, par exemple les utilisateurs sont regroupés dans **/ |