OpenVZ Forum


Home » General » Support » [how-to] allocating disk quota / memory / cpu
icon4.gif  [how-to] allocating disk quota / memory / cpu [message #2683] Sun, 16 April 2006 13:48 Go to next message
mohaw is currently offline  mohaw
Messages: 7
Registered: April 2006
Junior Member
Hi all,
I am a bit confused after reading all stuff & forums about allocating ram / cpu and disk space for VPS's. Could somebody please write down these commands with examples?

Example of a scenario:
VPSID: 100
CPU: 101 MHZ
RAM: 102 MB Ram
HDD: 103 MB disk space

Also, can we allocate resources for VPS's, over than host machine has?

Example of scenerio:

HOST
CPU: 1000 MHZ
RAM: 1001 MB
HDD: 1003 MB

VPS 1
CPU: 1000 MHZ
RAM: 600 MB
HDD: 800 MB

VPS 2
CPU: 1000 MHZ
RAM: 600 MB
HDD: 800 MB

Is this possible?

thanks.
Re: [how-to] allocating disk quota / memory / cpu [message #2692 is a reply to message #2683] Mon, 17 April 2006 10:04 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

I suggest you to start reading OpenVZ user's guide first.

Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: [how-to] allocating disk quota / memory / cpu [message #2698 is a reply to message #2683] Mon, 17 April 2006 11:40 Go to previous messageGo to next message
mohaw is currently offline  mohaw
Messages: 7
Registered: April 2006
Junior Member
Thanks kir, but of course i did read the manuals and guides. I want to be sure about what I did. Now changing the type of questions;

as I understand;

1) For hard&soft limiting disk space of VPS 100 to 4 GB;
command: vzctl set 100 --diskspace 4000000:4100000 --save
means: vzctl set [VPSID] --diskspace [Hard limit in KB's]:[Soft limit in KB's] --save

So, what is softlimit? why we use it?

2) For example I have P4 3.0 GHZ HT CPU and vzcpucheck shows;
Current CPU utilization: 2000
Power of the node: 148500

I want to (*NOT* guaranteed) share 600MHZ of my cpu;
command: vzctl set 100 --cpuunits 29700 --save
means: vzctl set 100 --cpuunits [(148500*600)/3000] --save

If I want to guarantee the cpu limit of VPS to 600 MHZ;
command: vzctl set 100 --cpulimit 20 --save
means: vzctl set 100 --cpulimit [(600*100)/3000] --save

So if I do not set [cpulimit] what is the meaning of this not guaranteed but what?

3) RAM how to? totally confused about this -)

Also all these commands may be wrong...





Re: [how-to] allocating disk quota / memory / cpu [message #2712 is a reply to message #2698] Mon, 17 April 2006 22:17 Go to previous messageGo to next message
zoom is currently offline  zoom
Messages: 19
Registered: March 2006
Location: Regina, Saskatchewan Cana...
Junior Member


So, what is softlimit? why we use it?

The purpose of a softlimit is to set a limit, however that limit can be exceeded based on the quotetime, or grace period. Soft limits are important because they allow processes to continue even though a limit has been exceeded. Think of it as a early warning, because once the hardlimit, or grace period has been reached that's it.

example: 4GB quota for VPS 100
Remember that disk quota block size for OpenVZ is 1024 Bytes

vzctl set 100 --diskspace 4194304:4718592
(VPS 100 softlimit 4G, hardlimit 4.5G)

vzctl set 100 --quotatime 86400
(VPS 100 can exceed the softlimit for 1 day)

Look at the user guide again it's very good and explaining how quotas are used in OpenVZ.



CPU shares (Re: [how-to] allocating disk quota / memory / cpu) [message #2713 is a reply to message #2698] Mon, 17 April 2006 22:45 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Think of cpu shares as a proportional weights. Remember, that all 100% of the CPU can be taken by a single VE if nobody else is using it. Still, in a situation when every VE demands a CPU, CPU time is shared according to cpuunits values, i.e. a VE which has less CPU share will get less CPU time.

Speaking of guarantees, as long as you do not oversell (i.e. sum of all cpuunits for all VEs + for the host system itself do not exceed "power of the node") -- you can guarantee a given share. If you oversell -- you can not guarantee that.

One more thing -- if you really want to hard limit CPU usage for a given VE, use --cpulimit parameter. In that case a VE will not be given more CPU time when specified by cpulimit, even if the CPU will be idling otherwise. But in real life this limit does not make much sense, unless you want something strange, e.g. see how does an application work on a slow hardware, or the like.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: [how-to] allocating disk quota / memory / cpu [message #29403 is a reply to message #2712] Sat, 12 April 2008 05:10 Go to previous message
SoftDux is currently offline  SoftDux
Messages: 55
Registered: November 2007
Location: Johannesburg, South Afric...
Member
zoom wrote on Tue, 18 April 2006 00:17




example: 4GB quota for VPS 100
Remember that disk quota block size for OpenVZ is 1024 Bytes

vzctl set 100 --diskspace 4194304:4718592
(VPS 100 softlimit 4G, hardlimit 4.5G)

vzctl set 100 --quotatime 86400
(VPS 100 can exceed the softlimit for 1 day)

Look at the user guide again it's very good and explaining how quotas are used in OpenVZ.





Thank you for the great explanation. What happens if the VE, in this example, use more than 4GB for more than 1 day (say 2 days)? Will it crash? Or what will happen?
Previous Topic: can't connect to public VPS randomly
Next Topic: max. amount of memory for ve limited?
Goto Forum:
  


Current Time: Tue May 14 04:09:07 GMT 2024

Total time taken to generate the page: 0.01421 seconds