0

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?

1
  • 1
    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, 2012 at 14:52

4 Answers 4

2

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.

1

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

0

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.

4
  • 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.
    – phemmer
    May 18, 2012 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, 2012 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.
    – phemmer
    May 18, 2012 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, 2012 at 12:26
0

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.

1
  • probably and nfs based datastore.
    – tony roth
    May 18, 2012 at 14:48

Not the answer you're looking for? Browse other questions tagged .