Cgroups-cpu: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Thomas (Diskussion | Beiträge)
Thomas (Diskussion | Beiträge)
 
(8 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 25: Zeile 25:
</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


=Ohne Einschränkung=
=Testprogramm=
*dd if=/dev/zero of=/tmp/test count=50 bs=100M
*apt install mathomatic-primes
50+0 records in
 
50+0 records out
=3 Limitierte Prozesse und einen Unlimitierten starten=
5242880000 bytes (5.2 GB, 4.9 GiB) copied, 23.0043 s, 228 MB/s
*cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
=Mit Einschränkung(Funktioniert nicht wie gewünscht)=
*cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
*cgexec -g blkio:/mygroup dd if=/dev/zero of=/tmp/test count=50 bs=100M
*cgexec -g cpu:cpulimited matho-primes 0 9999999999 > /dev/null
*cgexec -g cpu:lesscpulimited matho-primes 0 9999999999 > /dev/null
 
=Top=
*top
[[Datei:cgroup-1.png|600px]]

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