VMware vSphere

 View Only
Expand all | Collapse all

Dedicating CPU & Memory resources

  • 1.  Dedicating CPU & Memory resources

    Posted Jul 18, 2010 01:18 AM

    Hello experts,

    Is there a way to 100% dedicate resources to a guest machine?

    Suppose I have a 6 core machine with 12 GB ram.

    I have two production server guests and a few not-production guests (most of which aren't on unless I'm testing something out or the like) on it and I want one to have 2 CPUs all to itself with 4GB ram, and the other 1 CPU and 4GB ram. That would leave 3 CPUs for the rest and 4 (somewhat less after VM system) to fight over. I don't want any of their 4GB swapped or messed with by VM at all.

    Can this be done?

    Straight ESXi 4.0u2 machines here, no vCenter.

    -g



  • 2.  RE: Dedicating CPU & Memory resources

    Posted Jul 18, 2010 01:28 AM

    You can guarantee access to RAM using reservations set on a per VM basis. It won't automatically take all of the RAM unless it needs it, but it will prevent any other guests from using the RAM so the VM will have access to it if it needs it.

    You can also use CPU affinity to pin a particular VM to a specific CPU core (or cores), and then set all other VMs to use different cores instead. CPU affinity can get you into trouble if you don't manage it closely since by default new VMs will use any available processor. And if possible avoid CPU0 as many system level processes will use CPU0.

    I don't like CPU affinity but it might work ok if you just have a single host. If you expand to multiple hosts in a cluster I would avoid CPU affinity.



  • 3.  RE: Dedicating CPU & Memory resources

    Posted Jul 18, 2010 01:56 AM

    What you propose defeats the primary reason of virtualizing - allowing the resources to be shared between the virtual machines - so when your VM needs a full 2 cores it will get it but when it does it will be avialable for the other VMs -

    If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful



  • 4.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 12:30 AM

    Thank you both for replying!

    Background:

    I'm new to the VM-world and I mostly feel like I'm one of the Keystone Kops and stumbling blindly around the VM-world. I find many things extremely frustrating and often information isn't where I would think to look. Thank the good Lord that Google does a good job.

    I also thank those of you who have been helping me as I flounder around. One of the things I'm struggling with is the Performance Measurement and Tuning area.

    I'm playing with the limited performance tuning options I have and struggling with a dearth of good information about what the measures that I'm given mean and what the various knobs do and what the implications of twisting one are.

    The purpose of my question is to isolate (or lock down) some stuff to get it out of the picture and see what happens when I do that. Biggies are CPU, Memory, & I/O. If I can lock down CPU and Memory and things improve, then the problem was Memory or CPU. Otherwise it's I/O. If this is faulty thinking please let me know why.

    OK, back to the question at hand:

    The memory reservation is what I was thinking and that will reserve a specific amount of memory. But when I tried to type in 4GB it complained that I couldn't go bigger than 2xxxMB. How can I reserve 4GB ? The machine has 12GB.

    The idea was that if I reserved X amount and I allocate no more than X to the guest, then it will never use more and will therefore never swap (by VM). This memory would be effectively reserved to the guest and no interferrence by VM thus locking VM Memory management out of the picture. Is this correct?

    I knew about processor affinity and, now that you mention it, about keeping away from CPU 0. If I understood you correctly, in order to do a CPU dedication, I'd have to assign everybody and manage that. That would be a chore but for my purposes it may be a reasonable thing to do. I'd much rather be able to tell VM to reserve 2 CPUs (Cores) for guest 1, and 1 CPU (Core) for guest 2, and everybody else can use the remainder as vm would like to manage it.

    Can I make a reservation for X Mhz equivalent to 2 cores to guest 1? And would that mean that if guest 1 wasn't using them then that much would always be idle? And how would I go about measuring to see if what happens is what I think should be happening?

    Contrived example:

    Suppose I assign 2/6 of the Mhz available to an idle 2 cpu guest 1 and guests V, W, X, Y & Z start using 100% for some nefarious reason (5 single cpu guests each looping at 100%), what percent would each of the physical processors (6 of them) be running?

    Or to ask it another way, let's say each CPU is 100Mhz giving 600Mhz totally available on the host. 200Mhz is reserved to guest 1 which is idle. Each of another five guests are each trying to use 100%. If things were unreserved they would get 500Mhz (I think). Do they get more than 400Mhz ? Yes (& why)? or No?

    How can I measure to see what is actually happening?

    Regarding defeating the primary purpose of virtualization. I would say that hosting multiple guests on a single piece of hardware is the primary reason to virtualize. Equally important are the DR/BC aspects and, for me especially, the remote management aspects are a primary feature. I'm sure each of us has their own "Primary" with respect to virtualization.

    Again, thanks to all who participate in the forums helping those of us who are struggling with making the product an effective tool in our workplace!

    Blessings,

    -g



  • 5.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 01:14 AM

    As far as not being able to reserver more than the 2XXX MB, you can't reserve more than what is allocated to the VM. You may want to verify that you have assigned 4 GB to the VM already and then try to reserve. Also when reserving CPU it can still be allocated to other VM's when idle. Here is a good post by Duncan on CPU and memory reservation, http://www.yellow-bricks.com/2010/03/03/cpumem-reservation-behaviour/

    If you are having performance issues I suggest you search the ESXi forums for ways to monitor performance. There are some nice tools that will easily identify any each you are having with cpu, memory, or disk. I think for ESXi one of the big ones is resxtop.






    If you found this or any other post helpful please consider the use of the Helpful/Correct buttons to award points



  • 6.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 01:20 AM

    I want to correct you about how reservations work - a reservation does not carve out that chunk and hold it for that VM - a reservation comes into play when there s contention for that resource - so for example if you reserve a certain amount of MHz for a vCPU they are available to all VMs as long a sthere are enough CPU cycles for all VMs running - the same holds true for memory - the only difference is a memory reservation is activated for a VM that memory will be held for that VM and only released when the VM is shut down - so as long as there is no contention for memory or CPU resource then the reservation will not be activated -

    If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful



  • 7.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 12:58 PM

    I agree with what others have said already - if you're having performance problems in the environment I would try to narrow down why before messing with reservations or limits. The resxtop tool is a great place to start and will give you a lot of good information on how VMs are consuming resources.

    Here's a great place to start learning about resxtop and how to use it. This article refers to esxtop and resxtop is just a remote version of the same tool that you can use.

    http://www.yellow-bricks.com/esxtop/



  • 8.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 06:29 PM

    AllRight!

    Thanks for the comments and links. I've started poking around. I haven't found the download yet. Is this for the free ESXi ? Can somebody post a link? I can find references to a 2.x version, but nothing for 4.x. Found a lot of documents which I will be reading, but no download links yet.

    Thanks!

    -greg



  • 9.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 06:53 PM

    Before you go modifying anything spend time monitoring your virtual machines. Find out what they NEED. Use perfmon (part of windows). Other tools are available. There are some free capacity tools at http://www.vkernel.com/ Veeam has a monitor tool http://www.veeam.com/esxi-monitoring-free.html

    As mentioned earlier the resxtop using either the RCLI tools from the VMware download page or install the vMA http://vmware.com/go/vma

    I would have a look through the Overview section of this forum or run through the http://communities.vmware.com/community/vmtn/vsphere/quickstart



  • 10.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 07:16 PM

    ESXi 4.1 is out now. One nice new feature is the ability to enable SSH access to your Host from the vSphere Client. Once you enable SSH, then you can log into your ESX Host using a SSH Client (like putty) and run "esxtop" directly on the host.

    That way you don't have to spend the time getting a machine up and running in order to run resxtop (remote esxtop) on. But come to think of it, it might be faster to get a resxtop machine up and running then upgrading your Host to 4.1 :smileyhappy:

    Either way, here is a great guide for troubleshooting performance using ESXTOP:

    http://communities.vmware.com/docs/DOC-9279



  • 11.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 07:45 PM

    With the ESXi 4.0, the RCL stuff was read-only and I had already opened up the SSH because of that.

    Is the RCL in 4.1 useable again?

    Can I update/upgrade 4.0 to 4.1 via the Standalong Host Update tool (I should put that in a different question I suppose - what's the forum's desire on asking offshoot questions in an otherwise unrelated thread? New thread with mention to the old thread, just ask away, put in both?)

    Can I install the Resxtop with the Read-only RCL ?

    Good stuff, I'll be busy reading and snooping for sure!

    Thanks,

    -g



  • 12.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 07:51 PM

    The RCLI is still read only for most operations. Moving forward it will be the way to apply patches and upgrade so it is something you should get used to. If you want read write then I would suggest you upgrade to Essentials while it is still half price.



  • 13.  RE: Dedicating CPU & Memory resources

    Posted Jul 19, 2010 08:36 PM

    Thanks for the info.

    I did look at Essentials and it's 1/2 half price for now. For a year. I think I'm going to keep to the "as free as possible" route for my customers until they grow into multiple VM Hosts then I'll have enough ammo to talk them into the expense. We plan on another physical host when we start the Exchange & Sharepoint project. This will give us redundancy at a site in addition to the remote site which doubles as the DR location.

    I'll just SSH the thing if it's all the same. Very limited resources to run an SSH client and it works good over a VPN.

    -g