December 15th, 2010, 06:12 PM
Keeping a RAMdisk out of swap
I'm using some milters on a Sendmail box that recommends using a RAMdisk [tmpfs] to store temporary files, the performance benefits of which are quite noticeable. However, the problem is if a huge number of messages are all delivered at once this partition can be pushed off the physical memory and into swap. When this happens the performance tanks to about 1/20th to 1/30th of normal.
Is there anything I can do to keep a tempfs from being swapped to disk?
December 15th, 2010, 08:10 PM
um, if it doesn't swap you're going to lose the messages themselves rather than just losing some performance.
December 16th, 2010, 12:27 PM
Well I don't really mean to say "physical memory or bust" but rather "push everything else that can be put into swap into swap before the tmpfs".
The big picture really boils down to doubling the RAM in the machines, which we are doing very soon. But this is not a negligible performance decrease... Just a moderate spike in normal mail load across a cluster of 10 of these boxes caused them to dip into swap, scan times jumping from 400ms avg to 13,000ms avg for the span of a few minutes. Just a couple weeks ago we hit a corner case, a "Perfect Email Storm" if you will, that pushed scan times past the minute mark. Resolving that took some rather... drastic measures.
Anyhow, despite all of the other steps I've been taking to mitigate performance hits I am still a bit paranoid. Is there truly no way to set such a preference as to leave tmpfs in the physical memory?
I'd like to hear a solution to this as well. I have a monitoring application that runs in a ramdisk chrooted jail. It is specifically waiting for a condition where the system has started thrashing and all other logging fails. In this case it will email an admin reporting the current condition of the system, but if it is paged out as well it will fail.