Cgroups-blkio: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(13 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 39: Zeile 39:
 
</pre>
 
</pre>
  
=Feststellend er Major und Minor Nummer=
+
=Zustand der Drosselung checken=
 +
*cgget -g blkio /mygroup | grep blkio.throttle.write_bps_device
 +
blkio.throttle.write_bps_device:
 +
=Feststellen der Major und Minor Nummer=
 
*ls -l /dev/sda
 
*ls -l /dev/sda
 
  brw-rw---- 1 root disk 8, 0 Okt 12 22:24 /dev/sda
 
  brw-rw---- 1 root disk 8, 0 Okt 12 22:24 /dev/sda
 
=Geschwindigkeit einschränken=
 
=Geschwindigkeit einschränken=
*echo "8:16 1048576" > /sys/fs/cgroup/blkio/mygroup/blkio.throttle.write_bps_device
+
*echo "8:0 1048576" > /sys/fs/cgroup/blkio/mygroup/blkio.throttle.write_bps_device
 +
=Erneutes checken=
 +
*cgget -g blkio /mygroup | grep blkio.throttle.write_bps_device
 +
blkio.throttle.write_bps_device: 8:0 1048576
  
 
=Ohne Einschränkung=
 
=Ohne Einschränkung=
*dd if=/dev/zero of=/tmp/test count=50 bs=100M
+
*dd if=/dev/zero of=nix bs=4k count=10240  conv=fdatasync
  50+0 records in
+
  10240+0 Datensätze ein
  50+0 records out
+
  10240+0 Datensätze aus
  5242880000 bytes (5.2 GB, 4.9 GiB) copied, 23.0043 s, 228 MB/s
+
  41943040 bytes (42 MB, 40 MiB) copied, 0,848822 s, 49,4 MB/s
=Mit Einschränkung(Funktioniert nicht wie gewünscht)=
+
 
*cgexec -g blkio:/mygroup dd if=/dev/zero of=/tmp/test count=50 bs=100M
+
=Mit Einschränkung=
 +
*cgexec -g blkio:mygroup dd if=/dev/zero of=nix bs=4k count=10240  conv=fdatasync
 +
10240+0 Datensätze ein
 +
10240+0 Datensätze aus
 +
41943040 bytes (42 MB, 40 MiB) copied, 53,921 s, 778 kB/s

Aktuelle Version vom 19. Oktober 2017, 12:44 Uhr

Anlegen einer Control Group

  • cgcreate -g blkio:/mygroup

Checken

  • lscgroup | grep blkio:/mygroup
blkio:/mygroup

Welche Parameter sind Subsystem Block-I/O vorhanden

  • cgget -g blkio /mygroup
/mygroup:
blkio.throttle.io_serviced: Total 0
blkio.io_service_bytes_recursive: Total 0
blkio.io_serviced_recursive: Total 0
blkio.time:
blkio.io_serviced: Total 0
blkio.reset_stats:
blkio.io_wait_time: Total 0
blkio.weight: 500
blkio.leaf_weight_device:
blkio.throttle.read_iops_device:
blkio.io_merged_recursive: Total 0
blkio.throttle.write_bps_device:
blkio.leaf_weight: 500
blkio.sectors_recursive:
blkio.weight_device:
blkio.io_service_time_recursive: Total 0
blkio.throttle.write_iops_device:
blkio.throttle.io_service_bytes: Total 0
blkio.io_service_bytes: Total 0
blkio.io_wait_time_recursive: Total 0
blkio.io_service_time: Total 0
blkio.time_recursive:
blkio.io_merged: Total 0
blkio.throttle.read_bps_device:
blkio.sectors:
blkio.io_queued: Total 0
blkio.io_queued_recursive: Total 0

Zustand der Drosselung checken

  • cgget -g blkio /mygroup | grep blkio.throttle.write_bps_device
blkio.throttle.write_bps_device:

Feststellen der Major und Minor Nummer

  • ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 Okt 12 22:24 /dev/sda

Geschwindigkeit einschränken

  • echo "8:0 1048576" > /sys/fs/cgroup/blkio/mygroup/blkio.throttle.write_bps_device

Erneutes checken

  • cgget -g blkio /mygroup | grep blkio.throttle.write_bps_device
blkio.throttle.write_bps_device: 8:0 1048576

Ohne Einschränkung

  • dd if=/dev/zero of=nix bs=4k count=10240 conv=fdatasync
10240+0 Datensätze ein
10240+0 Datensätze aus
41943040 bytes (42 MB, 40 MiB) copied, 0,848822 s, 49,4 MB/s

Mit Einschränkung

  • cgexec -g blkio:mygroup dd if=/dev/zero of=nix bs=4k count=10240 conv=fdatasync
10240+0 Datensätze ein
10240+0 Datensätze aus
41943040 bytes (42 MB, 40 MiB) copied, 53,921 s, 778 kB/s