Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Now I'm trying to create KVM templates with CentOS and I'm not sure should I create swap partition on guest OS or not. In future it will be lot's of small VPS with 256-1024Mb RAM and if swap partition is a good idea will be 256Mb of swap enough for making them more stable?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Sure. Go for it... Those sound like low-memory virtual machines. It may be helpful to have swap in place in the event memory is exhausted. If not, you can always add swap files later.

share|improve this answer
    
+1 having a bit of swap never hurts –  dyasny Sep 13 '12 at 11:16

In particular for systems with small amounts of RAM some swap is most important.

I have a setup with about 100 of small vps with 384 MB RAM on one mid-sized physical machine, most of them look like this:

# free -m
         total       used       free     shared    buffers     cached
Mem:           375        330         44          0         60        215
-/+ buffers/cache:         55        320
Swap:          487          4        486

So it is good to have some swap, or the vps stated above most likely would have crashed without swap.

To reduce CPU load when the vps wants to use swap the first time and you know that would happen, it would be very good using preallocation (using qcow2 images).

On a physical machine with many vps one can imagine that a machine would get a very high load if many of the running vps want to swap in an area that has still to be allocated.

Talking of me I would rather use more RAM (about +124MB) on the vps for future installations, now that I know that some vps swap (even if only 4MB).

share|improve this answer

Your Answer

 
discard

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.