Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running several virtual machines on VMware ESXi (mostly Centos but few are Ubuntu) and it seems like there are two different ways of dealing with memory allocation. Here are two examples:

(a) allocate 4GB memory to virtual machine and create 2GB swap file.

(b) allocate 6GB of memory to virtual machine and no swap file.

What are pros and cons of these approaches?

share|improve this question

ESXi, overcommit and swap and ballooning is far from trivial. It is easy to end up in situations that are extremely bad performance wise, such as having the VM do Memory Mapped IO into ram that is being Swapped by the hypervisor. Giving recommendations based on the limited information you posted is not really possible.

I suggest you start by reading the Resource Management Guide for vSphere. Especially the chapter on the memory system should be interesting to you. If you have more specific questions after going through the guide please return and ask again.

share|improve this answer
Good point. We specifically run some applications that use memory mapped IO. – dtoubelis Jun 22 '11 at 17:58

Performance-wise, swap space is not really an extension to normal, physical RAM. Whether your machines will need swap space or not is largely determined by what role they are fullfilling. For example, it is recommended for machines running an Oracle database to have some amount of swap space (Oracle has official recommendations for this), no matter the amount of RAM installed.

ESX can do over committing of memory, so if you allocate 6GiB of RAM to each machine, it does not mean each machine actually consumes each bit of that 6GiB.

ESX will also swap out memory on its own. ESX will create a swap file per VM and, if need be, will swap out memory of the VM to disk. To the VM, it will still seem like the memory blocks are located in RAM, even though they will come from disk.

If you can spare the RAM and your VM's require it, allocate 6GiB to them. This does not mean they will not benefit from having a swap partition inside the VM though. By default, Linux will try to swap out unused memory. This is defined by the "vm.swapiness" sysctl parameter.

To make a long story short, just listing the options will not give you a one size, fits all answer to how to configure your RAM. Tell us more: purpose, hardware, etc.

share|improve this answer
Good point. We also use java apps that allocate memory in a similar way to Oracle. – dtoubelis Jun 22 '11 at 18:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.