4 ms·
Two observations: First, setting vm.swappiness to 0 does not have the beneficial impact that people say it does, and yet it's religious dogma to set it that wa
by otterley 13y ago
Two observations:
First, setting vm.swappiness to 0 does not have the beneficial impact that people say it does, and yet it's religious dogma to set it that way on MySQL servers. To my knowledge there has never been a single article published that clearly demonstrates its benefit under a controlled test. The evidence of any benefit is anecdotal at best.
Second, you can easily exclude any process from being killed by the kernel's OOM killer: "echo -17 > /proc/PID/oom_adj"
- falcolas 13y ago> Second, you can easily exclude any process from being killed by the kernel's OOM killer: "echo -17 > /proc/PID/oom_adj" Doing such with a large memory process is a sure way to cause a server to shut down and reboot when it runs out of memory. OOM killer is bad to large memory processes, but the alternative is worse. Ideally you don't want to swap, you definitely don't want to preemptively swap, but even swapping is better than rebooting a server.
- otterley 13y agoI don't know about "definitely." Swap death is often worse than a reboot because (a) response latency goes through the roof, effectively making the service down anyway, and (b) you probably can't log in anyway because of I/O saturation (ssh, shell etc. could well be swapped out).
- leif 13y ago(c) a load balancer can often understand a server that's down, a server that might end up doing I/O while holding locks probably wouldn't be detected.
- rodgerd 13y agoIndeed. I've had zLinux boxes using VDISKs for swap that get it to the terrible state where the VDISK can sustain swapping at a high enough rate that Oracle will be able to accept and maintain connections, but not do any work. The application attached to the database is unable to see this as a failure and flop over to the other node in the RAC.
- sitkack 13y agoSounds like underspecified failure conditions. Rarely are they as clean as, "I am dying, poof!"
- sitkack 13y agoAgreed, too many people conflate any kind of paging with server death. Yeah servers get slow when they start paging too much, most of the time I can still login and checkout what is going on. So much time is wasted by not enough swap space resulting in rebooted or hung machines. The way linux memory allocation works, it is really not a good idea to constrain swap. It is really easy to trigger the OOM killer by using up too much virtual address space. Doing a `fork/exec` from a process near your physical memory limit can easily get you over virtual memory limit with not enough swap, even though under this condition no paging would occur. swap on and have great week.