[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Doubt on XEN memory management: please clarify

  • To: xen-users <xen-users@xxxxxxxxxxxxx>
  • From: Simon Hobson <linux@xxxxxxxxxxxxxxxx>
  • Date: Sat, 14 Apr 2012 19:57:22 +0100
  • Delivery-date: Sat, 14 Apr 2012 18:58:37 +0000
  • List-id: Xen user discussion <xen-users.lists.xen.org>

Flavio wrote:

Let's go with my XEN setup now.
I have 8GB of RAM and I have seen that if I put dom0_mem=1024M option, the dom0
has 1GB of RAM for itself.
What does this really mean?

The default is that when you boot, all the system RAM (less a bit used by Xen itself) will be 'available' to Dom0. As you start guests, then Dom0 will balloon down it's memory availability to free memory for the guest. This all works fine, and as long as you never force memory down too low then Dom0 won't complain - you can set a minimum below which Dom0 will not balloon and it would be a good idea to tune this to your requirements.

Now, for a couple of reasons this isn't ideal. The main reason is that certain buffers and structures used to keep track of "stuff" are sized at boot time based on the amount of memory available. So in your case, you start with 8G of RAM but potentially balloon down to as little as 1/4G (256M) - just 1/32 of the size. So you now have a system running in a small amount of RAM but with buffers and structures sized for a lot of RAM (about 32 times what it actually has available in this case).

Also, each time you start a guest (or alter a guest's memory allocation), then the host's memory configuration must be changed which takes a little time.

Lastly, these changes in memory allocation will (or may) affect performance in some areas - giving a variable system performance depending on how many guests are running and how much RAM they use.

So it's a good idea to specify how much memory to give to Dom0. It will then size things to suit (which in itself will reduce it's memory footprint). You can still balloon between high and low limits, or you can set a fixed allocation and have deterministic performance and minimum memory usage.

This is confusing me, because I don't understand how
to decide the amount of RAM to assign to the dom0. For example, what if I assign
256M? What if 8192M?

8G isn't a good choise - see above about sizing of buffers and structures.

256M may or may not be enough - only you can only determine that for your setup, it depends on what is running on the system. If you run just the bare minimum of software/services on Dom0 then it may well be enough, but if you run other things (particularly memory hungry programs) it might not be enough. You need to pick a value (not too low, try starting at 512M and work down) and then look at how the system is running - look at how much memory is used for different things (cat /proc/memory) and particularly if it is swapping (very bad for performance). Normally, you don't tend to do much in Dom0, so not having large caches isn't really an issue (it just delays things when stuff has to read from disk instead of cache when you issue a command) as long as all the stuff that's running "all the time" or "frequently" can stay in RAM.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.