Cgroups-cpu: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „=Anlegen einer Control Group= *cgcreate -g blkio:/mygroup =Checken= *lscgroup | grep blkio:/dd blkio:/dd =Welche Parameter sind Subsystem Block-I/O vorhande…“)
 
 
(13 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
=Anlegen einer Control Group=
+
=Anlegen von Control Groups=
*cgcreate -g blkio:/mygroup
+
*cgcreate -g cpu:/cpulimited
 +
*cgcreate -g cpu:/lesscpulimited
  
=Checken=
+
=Welche Parameter sind vorhanden=
*lscgroup | grep blkio:/dd
+
*cgget -g cpu /cpulimited
blkio:/dd
+
<pre>
 
+
/cpulimited:
=Welche Parameter sind Subsystem Block-I/O vorhanden=
+
cpu.shares: 1024
*cgget -g blkio  /mygroup
+
cpu.cfs_quota_us: -1
 +
cpu.stat: nr_periods 0
 +
nr_throttled 0
 +
throttled_time 0
 +
cpu.cfs_period_us: 100000
 +
</pre>
 +
*cgget -g cpu /lesscpulimited
 
<pre>
 
<pre>
/mygroup:
+
/lesscpulimited:
blkio.throttle.io_serviced: Total 0
+
cpu.shares: 1024
blkio.io_service_bytes_recursive: Total 0
+
cpu.cfs_quota_us: -1
blkio.io_serviced_recursive: Total 0
+
cpu.stat: nr_periods 0
blkio.time:
+
nr_throttled 0
blkio.io_serviced: Total 0
+
throttled_time 0
blkio.reset_stats:
+
cpu.cfs_period_us: 100000
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
 
 
</pre>
 
</pre>
  
=Geschwindigkeit einschränken=
+
=cpu.shares auf 512 in den cpulimited group=
*echo "8:16 1048576" > /sys/fs/cgroup/blkio/mygroup/blkio.throttle.write_bps_device
+
Normaler Wert ist 1024
 +
*cgset -r cpu.shares=512 cpulimited
 +
 
 +
=Testprogramm=
 +
*apt install mathomatic-primes
 +
 
 +
=3 Limitierte Prozesse und einen Unlimitierten starten=
 +
*cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
 +
*cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
 +
*cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
 +
*cgexec -g cpu:lesscpulimited matho-primes 0 9999999999 > /dev/null
  
=Ohne Einschränkung=
+
=Top=
*dd if=/dev/zero of=/tmp/test count=50 bs=100M
+
*top
50+0 records in
+
[[Datei:cgroup-1.png|600px]]
50+0 records out
 
5242880000 bytes (5.2 GB, 4.9 GiB) copied, 23.0043 s, 228 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
 

Aktuelle Version vom 14. Oktober 2017, 16:53 Uhr

Anlegen von Control Groups

  • cgcreate -g cpu:/cpulimited
  • cgcreate -g cpu:/lesscpulimited

Welche Parameter sind vorhanden

  • cgget -g cpu /cpulimited
/cpulimited:
cpu.shares: 1024
cpu.cfs_quota_us: -1
cpu.stat: nr_periods 0
	nr_throttled 0
	throttled_time 0
cpu.cfs_period_us: 100000
  • cgget -g cpu /lesscpulimited
/lesscpulimited:
cpu.shares: 1024
cpu.cfs_quota_us: -1
cpu.stat: nr_periods 0
	nr_throttled 0
	throttled_time 0
cpu.cfs_period_us: 100000

cpu.shares auf 512 in den cpulimited group

Normaler Wert ist 1024

  • cgset -r cpu.shares=512 cpulimited

Testprogramm

  • apt install mathomatic-primes

3 Limitierte Prozesse und einen Unlimitierten starten

  • cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
  • cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
  • cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
  • cgexec -g cpu:lesscpulimited matho-primes 0 9999999999 > /dev/null

Top

  • top

Cgroup-1.png