Using SSDs as swap

Willem Jan Withagen wjw at digiware.nl
Sat Aug 8 13:29:51 UTC 2015


On 8-8-2015 13:37, Konstantin Belousov wrote:
> On Sat, Aug 08, 2015 at 01:08:59PM +0200, Willem Jan Withagen wrote:

>> Would it be more intense than being beaten to death as a ARC cache??
> No idea.  Ask somebody who understands how ARC works.
> 
> Swap is used for pageouts, and typical pageout involves the page and
> some amount of pages surrounding it in the vm object' queue.  Defaults
> are 32 pages as the maximum clustered pageout size, but I believe that
> it is typically cannot be achieved, I would expect that often the
> very minimalistic i/o requests are blasted. It might be better if the
> dirty mappings are promoted to superpages, but I think that the promotion
> is not likely to happen if your machine already started swapping.
> 
> Anyway, I do not posses a statistic for the pageout patters on the
> real workloads. With the current state of hardware, it is much more
> reasonable to buy enough RAM, which would give you two orders of
> magnitude of the speedup, than to target swap subsystem optimization to
> provide you e.g. 10-20% improvements comparing with the current state of
> the code.

I agree fully, but if you are running with hardware that does not allow
this, that is not really an option. :(
There are quite a lot of motherboard/processors combinations about that
little RAM to either 4G of 8G. Upgrading that so something that allows
you to do 32G, sets you back about 500-700 euros. You also get more
power out of the CPU, but like in (small) fileservers, CPU power is
rarely the problem.

And what I see on some of the servers is that there very little moments
in time that there is some swapping going on....
Like during nightly chores: building world/kernel, building locate.db,
etc.... It starts to push a bit of stuff into swap. Its not even that
bad, about 300-800Mb, 2 Gb if I really push it very hard.

BTW, as far as pricing I can get 8Gb ECC RAM for about 55 euro. Looking
at a Samsung 256Gb SSD (evo) prices as about 100 euro in the last
purchase. So it is: 1Gb Ram for 7 euro versus 1Gb SSD for 0,40 Euro.
So the price difference is a factor of ~20.
So on systems that are not continously swapping, I would consider this a
fair tradeoff.

So perhaps the nicest thing to do for the SSDs is TRIM swap at
startup??? So the the SSD controller van do its garbage collection and
then keep the remainder of the stuff as it is.

I did have cache and swap traces when I was working at the University,
but that was late 80's. So caches were like 2K (no l1,l2,l3 stuff) and
RAM ended somewhere at 64Mbyte. Life has changed a lot since then. :)
I still have the DAT tape with the traces as a memorabilia ... The HP
drive has long since died, and the tape probably won't read anyways.

--WjW



More information about the freebsd-fs mailing list