Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

The Linux servers are running on some VMWare ESX systems (guessing, I'm just user). These systems don't have the disks directly attached: they perform everything on a virtual disk that is actually a file on a NAS.

The Linux system is configured with one disk drive /dev/sda split into three partitions (/boot, /, and swap). The swap partition is actually used as swap space for the system. But it is actually on the network, not on local hard drive. Given the poor latency of the network, what's the point of having a swap partition for the system on the disk that is virtualized and distant?

This looks to me as plain stupid.

Any hint from more experienced virtualization specialists?

share|improve this question

closed as not constructive by ThatGraemeGuy, John Gardeniers, Sven, Khaled, Steven Monday May 18 '12 at 16:40

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

its somewhat stupid in that you'll have nfs host based datastore somewhere thats busy doing many other things along with a limit on bandwidth so if your vm needs to swap it will use the the same disks same pipe that the other vms will use. So unless you have a seperate nfs host and pipe for just swapping then it won't matter if you try to seperate this out. – tony roth May 18 '12 at 14:52

Swap space is always suffering from extreme latencies when compared to RAM, putting it onto the network makes things only slightly worse.

It should always be used as a last resort for when things go wrong and if you find that your machine actually uses a significant amount of swap space, you need more RAM for the VM.

share|improve this answer

you can always create a separate virtual disk, put it on another, faster storage, and mount swap there. Or turn swap off completely - it's all really a matter of your use case and system loads

share|improve this answer

Swap nowadays appears to be an emergency mechanism to avoid killing processes in case of memory outage. Almost no real server can continue operating normally with heavy swapping. It doesn't matter if you have disk connected locally or via SAN.

share|improve this answer
This is very inaccurate. Using swap instead of killing processes causes the heaving swapping youre talking about. Preemptively swapping idle pages is what swap is best for as it causes very little thrashing. – Patrick May 18 '12 at 12:01
I know that heavy swapping is bad. But ain't oom-killer worse? Preemptive swapping is usually also bad for production servers under a decent load. Luckily I can deal with excessive preemptive swapping with vm.swappiness=0 – DukeLion May 18 '12 at 12:09
I would say no. When the machine is thrashing the disk, the entire server grinds to a halt. While killing a process isnt good, its worse to have the entire server pretty much useless. And preemptive swapping is a good thing, it swaps out pages that arent being used and can spare the server more memory for cache. Setting swappiness to 0 is rarely (though occasionally) a good practice. – Patrick May 18 '12 at 12:20
Agreed. But in my opinion I should ever have spare capacity to work-around faulty server. And my setup should automatically redirect load to alive servers. So I'd prefer useless server that I can debug, instead of regular failures I cannot deal with. Also sometimes oom-killer can kill vital process, and only way to revive server will be manual or ipmi reboot, resulting in longer MTTR for server. – DukeLion May 18 '12 at 12:26

Are youcertain the disks are on a NAS? More likely they are on SAN in which case network latency shouldn't be an issue. Or if it is, you've got bigger problems than needing to write SWAP to it.

share|improve this answer
probably and nfs based datastore. – tony roth May 18 '12 at 14:48

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