Editing
Msg08478.html
(section)
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Re: [Vserver] Mini Howto for CPU hard limits = ----- * '''From:''' Herbert Poetzl * '''Date:''' Mon, 20 Dec 2004 04:32:34 +0100 (CET) ----- <pre>On Mon, Dec 20, 2004 at 02:00:42AM +0100, Thorsten Gunkel wrote: > (Please ignore that until Herbert/Bertl acknowledges that I didn't > misunderstood him completely ;-)) okay, so I'm adding my remarks now ... > Hi *, > just in case this is interesting for someone: > > ********* Mini Howto for CPU hard limits ************ > > I did it with: > > - 2.6.9 vanilla Kernel > - patch-2.6.9-vs1.9.3.diff > > In kernel config enable > > CONFIG_VSERVER_HARDCPU=y > > and optionally only required if you explicitely want the idle process to be limited too (i.e. get lower idle intervals between vserver schedules) > CONFIG_VSERVER_HARDCPU_IDLE=y > > You may check if your kernel already supports this with: > > gzip -dc /proc/config.gz | grep CONFIG_VSERVER_HARDCPU > (this will only work if your kernel creates a /proc/config.gz file, > otherwise try > grep /usr/src/linux/.config -e CONFIG_VSERVER_HARDCPU > otherwise) > > Now change to the etc folder for the vserver you want to hardlimit the > cpu power. > > Create a file named flags and write > > sched_hard > > into it (don't forget final linebreak). If this file already exists > just append the new line. > > Now create a file named schedule. It must have 6 lines: > > FillRate > Interval > StartNrOfTokens > tokens_min > tokens_max > IGNOREFORNOW > > In short your vserver can only consume cpu power if it has tokens > left (to be more precisely: if it has more than tokens_min tokens). well, you can consume as long as tokens are availabel (regardless of the tokens_min setting) but to get back into 'businenss' you need at least tokens_min tokens in the bucket ... > The more cpu power it uses the more token it looses :-). each running process consumes a token per jiffie (tick) but only if it is actually executed by a cpu ... > At the start it has StartNrOfTokens (or TokensMax if that is > smaller?). After each Interval has passed it gets FillRate new ones > until it reaches tokens_max. > > So in short: > higher FillRate and lower Interval -> more cpu power. > > Example for your schedule file: > > 20 > 100 > 600 > 0 > 500 > 0 > > Every 100 ticks 20 new tokens, no tokens_min (one token is enough to be > back in business) max 500 tokens and a startvalue of > 600 tokens (well, ...). the 100/20 means 20% of the total available 'cpu power' (in average) and the 500 tokens max, means a 'burst' time of about half a second with 1k ticks (default) > Now start your vserver (don't enter it yet) and check > > cat /proc/virtual/YOURID/status > > | ... > | Flags: 0000000202000110 > ^ > > It should end with 1.. > If it doesn't your flags file is broken, try: > > vattribute --set --xid YOURID --flag ^8 > or > vattribute --set --xid YOURID --flag sched_hard > > > Now check > > cat /proc/virtual/YOURID/sched > > Token: 500 > FillRate: 20 > Interval: 100 > TokensMin: 0 > TokensMax: 500 > PrioBias: 0 > cpu 0: 59 48 0 > > > If you now consume CPU power inside the vserver the Token value will > drop, if it reaches zero your vserver will stop and after 20 ticks > you'll get new tokens. > > Have fun > Thorsten looks good, thanks, Herbert > _______________________________________________ > Vserver mailing list > Vserver@xxxxxxxxxxxxxxxxxxxxxx > http://list.linux-vserver.org/mailman/listinfo/vserver </pre> ----- * '''References''': ** '''[[msg08477.html|[Vserver] Mini Howto for CPU hard limits]]''' *** ''From:'' Thorsten Gunkel * Prev by Date: '''[[msg08477.html|[Vserver] Mini Howto for CPU hard limits]]''' * Next by Date: '''[[msg08479.html|[Vserver] Trouble connecting to own addresses]]''' * Previous by thread: '''[[msg08477.html|[Vserver] Mini Howto for CPU hard limits]]''' * Next by thread: '''[[msg08481.html|Re: [Vserver] Mini Howto for CPU hard limits]]''' * Index(es): ** [[index.html#08478|'''Date''']] ** [[threads.html#08478|'''Thread''']]
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information