Linux Performance: Why You Should Almost Always Add Swap Space
Cargo cult system administration.<p>No, you should not &#x27;almost always add swap space&#x27;. What you should do instead is tune your system for its intended use.<p>If you need swap as an &#x27;early warning system&#x27; that you&#x27;re about to run out of memory you&#x27;re already doing it wrong and the OOM killer is a piece of code that has default settings that can be tuned, ditto for the virtual memory manager in the kernel.<p><a href="http:&#x2F;&#x2F;www.oracle.com&#x2F;technetwork&#x2F;articles&#x2F;servers-storage-dev&#x2F;oom-killer-1911807.html" rel="nofollow">http:&#x2F;&#x2F;www.oracle.com&#x2F;technetwork&#x2F;articles&#x2F;servers-storage-d...</a><p><a href="https:&#x2F;&#x2F;access.redhat.com&#x2F;documentation&#x2F;en-us&#x2F;red_hat_enterprise_linux&#x2F;6&#x2F;html&#x2F;performance_tuning_guide&#x2F;s-memory-captun" rel="nofollow">https:&#x2F;&#x2F;access.redhat.com&#x2F;documentation&#x2F;en-us&#x2F;red_hat_enterp...</a><p>Select appropriate equivalent for your kernel where applicable, and don&#x27;t forget about the per-process limits in ulimit.<p>This sort of &#x27;almost useless&#x27; advice is pretty annoying, it shows that the writer has an interest in the matter but didn&#x27;t bother to dig in deep enough to make the advice truly useful.<p>Also, the comment on that article that implies that swap will allow you to update a running process because it is backing the image is wrong, the backing is simply done through the filesystem and swap space has nothing to do with it. The practical upshot of which is that you&#x27;re not going to be able to reclaim the space held by the binary if you should remove it because the &#x27;file is busy&#x27; until the last instance of that process exits. In the meantime, if you really want to run the newer version under the old name or path then you&#x27;re free to unlink it or &#x27;mv&#x27; it to a different location and to start the new binary from the default location. On some Unixes you can even overwrite the binary using an mv command making it look like the old one has disappeared but again, under the hood it will still be held open, you can check this using lsof or whatever is your local equivalent to see that the file is indeed still present. In a pinch (and you really really have messed up if you ever need this trick) you can re-link the running image by hard linking to the inode.