[vserver] CPU hard limit

From: Jeff Jansen <jeff.jansen_at_kkoncepts.net>
Date: Fri 03 Apr 2009 - 12:12:55 BST
Message-ID: <49D5EF37.40000@kkoncepts.net>

I'm having no luck imposing a hard limit on CPU usage on a guest. I'm sure I'm
missing something simple, but after a couple of days of looking, I can't find
it. :-)

Host (vserv2) is a quad core Xeon. Host and guest are both 64-bit debian lenny

vserv2:~# uname -a
Linux vserv2 2.6.26-1-vserver-amd64 #1 SMP Fri Mar 13 20:19:13 UTC 2009 x86_64
GNU/Linux
vserv2:~# dpkg -l util-vserver
<snip>
ii util-vserver 0.30.216~r2772-6

The guest has the sched_hard flag.

vserv2:~# vattribute --xid 40003 --get
<snip>
flags:
fakeinit,sched_hard,virt_mem,virt_uptime,hide_netif,state_init,state_admin,sc_helper

vserv2:~# cat /proc/virtual/40003/status
UseCnt: 136
Tasks: 57
Flags: 0000001602030110
BCaps: 00000000344c04ff
CCaps: 0000000000000101
Spaces: 1c020200

I throttle the guest, giving it only 1 token every 1000 ticks. leaving all the
other defaults alone.

vserv2:~# vsched --xid 40003 --fill-rate 1 --interval 1000 --force
vserv2:~# cat /proc/virtual/40003/sched
FillRate: 1,1
Interval: 1000,8
TokensMin: 15
TokensMax: 125
PrioBias: 0
cpu 0: 19 16 0 0 0 R- 62 15 125 1/1000 1/8 0 0
cpu 1: 27 32 0 0 0 R- 62 15 125 1/1000 1/8 0 0
cpu 2: 21 18 0 0 0 R- 62 15 125 1/1000 1/8 0 0
cpu 3: 39 18 0 0 0 R- 62 15 125 1/1000 1/8 0 0

Then I go into the guest and start a very CPU intensive process (a perl script
which calculates PI to a zillion digits.) One core immediately goes to 100%.
If I background the script and run another instance, another core immediately
goes to 100$

vserv2:~# vtop
top - 19:01:33 up 13 days, 4:39, 2 users, load average: 1.84, 0.79, 0.39
Tasks: 795 total, 3 running, 792 sleeping, 0 stopped, 0 zombie
Cpu0 : 0.6%us, 0.0%sy, 0.0%ni, 99.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 0.3%us, 0.3%sy, 0.0%ni, 99.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 6133056k total, 6053108k used, 79948k free, 138624k buffers
Swap: 1959912k total, 6096k used, 1953816k free, 3146428k cached

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

26705 root 20 0 17748 1672 1328 R 100 0.0 2:28.88 pi.pl

26764 root 20 0 17748 1676 1328 R 100 0.0 1:57.32 pi.pl

But nothing ever shows as going on hold in the vserver.

vserv2:~# cat /proc/virtual/40003/sched
FillRate: 1,1
Interval: 1000,8
TokensMin: 15
TokensMax: 125
PrioBias: 0
cpu 0: 21 16 0 0 0 R- 62 15 125 1/1000 1/8 0 0
cpu 1: 1163 34 0 0 0 R- 62 15 125 1/1000 1/8 0 0
cpu 2: 41631 45 0 0 0 R- 62 15 125 1/1000 1/8 0 0
cpu 3: 32624 28 0 0 0 R- 62 15 125 1/1000 1/8 0 0

Any advice, ideas, or words of wisdom are greatly appreciated.

Jeff Jansen
Received on Fri Apr 3 12:13:13 2009

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 03 Apr 2009 - 12:13:16 BST by hypermail 2.1.8