Subject: how to limit cpu without CGroup
From: songjun435 <songjun435@gmail.com>
Date: Wed, 7 Mar 2012 20:51:11 +0800
Wed, 7 Mar 2012 20:51:11 +0800
hi,all:
I want to limit cpu of the vps. From the document,there are two methods:
the first one is to use the cgroup to limit the cpu;
the second one is to use the commond 'vattribute' 'vsched'.
But as I knowmy linux kernel is 2.6.18 which do not support the cgroup. So I only
to use the second method.

Then I do it as following(my cpu has 16 processors):
1.vserver test start
2.vattribute --set --xid 42 --flag sched_hard
42 is the contextID of test
3.vsched --xid 42 --fill-rate 1 --interval 4 --tokens-max 50000 --token-min 2500 --idle-time
--force
   Above commond set the test vps most occupy 1/4(25%) proportion of the CPU
   that is the hard cpu limit of the test vps is 25%

4.then I enter the vps,and execute 8 Transcoding programmes 'ffmpeg',
  then I execute top to check the cpu status:
   it shows that the cpu has been used 50%, which mean the 8 ffmpeg programmes occupy
50% of the cpu, not 25% which is the hard cpu limit.

So, could anyone know why there is no effect on the cpu limit after I use 'vattribute''vsched'
to set the hard limit of CPU?
How should I do to limit CPU without CGroup?
I will appreciate it if you give some clue.





3NMedia

hi,all:
I want to limit cpu of the vps. From the document,there are two methods:
the first one is to use the cgroup to limit the cpu;
the second one is to use the commond 'vattribute' 'vsched'.
But as I know£¬my linux kernel is 2.6.18 which do not support the cgroup. So I only to use the second method.
 
Then I do it as following(my cpu has 16 processors):
1.vserver test start
2.vattribute --set --xid 42 --flag sched hard
42 is the contextID of test
3.vsched --xid 42 --fill-rate 1 --interval 4 --tokens-max 50000 --token-min 2500 --idle-time --force
   Above commond set the test vps most occupy 1/4(25%) proportion of the CPU
   that is the hard cpu limit of the test vps is 25%
 
4.then I enter the vps,and execute 8 Transcoding programmes 'ffmpeg',
  then I execute top to check the cpu status:
   it shows that the cpu has been used 50%, which mean the 8 ffmpeg programmes occupy 50% of the cpu, not 25% which is the hard cpu limit.
 
So, could anyone know why there is no effect on the cpu limit after I use 'vattribute''vsched' to set the hard limit of CPU?
How should I do to limit CPU without CGroup?
I will appreciate it if you give some clue.
 
 

3NMedia
Ëξü