8

Is there software for Linux to use an SSD as disk cache? I believe that Sun does something like this with ZFS, though not sure. A quick search provides nothing suitable. The goal would be to put frequently requested files on the SSD on-the-fly. Since the SSD has more capacity than RAM for less money and better performance than hard disk, this should provide an efficient performance boost.

casualcoder
  • 370
  • 1
  • 4
  • 13
  • Are you sure SSD is nice for caching? As far as i know, SSD have rewrite limit of about 10000 cycles... – kolypto Dec 07 '09 at 00:05
  • 6
    Good grief, modern flash SSDs are good for allegedly millions of cycles of writes. See http://serverfault.com/questions/14189/reliability-of-ssd-drives for some further comments. Furthermore, the server will likely be serving up a similar set of files frequently. – casualcoder Dec 07 '09 at 02:59
  • See also http://serverfault.com/questions/239808/ssd-for-swap-on-ubuntu-server/239817#239817, which is about swap, but the same caveats apply. – mattdm Feb 25 '11 at 17:34
  • 1
    Actually it depends. And it isa shame i have to say that in a forum for professionals. There are terrible end user drives out there (25gb, 50gb per day allowed write budget) and thera re high end enterprise drives with 25+ complete rewrites per day(guaranteed over the 5 years you get warranty) and more, which is a LOT of data even for a cache. So, yes, they are adequate if you do not buy total crap cheapo stuff taht is meant for a low use laptop. – TomTom Apr 25 '14 at 04:27

4 Answers4

6

Facebook recently released a module for the Linux kernel called 'FlashCache' which can do exactly this:

http://github.com/facebook/flashcache

user43833
  • 76
  • 1
  • 2
2

Have you looked into Bcache? http://bcache.evilpiepirate.org/

I realize this is an old topic, hope this helps anyone else who might have arrived here like me with an ssd cache question.

diecast
  • 31
  • 3
1

With SUN's ZFS, SSDs can be used as L2ARC cache [1], using the zpool add cache command:

cache

A device used to cache storage pool data. A cache device cannot be cannot be configured as a mirror or raidz group. For more information, see the “Cache Devices” section.

I know nothing similar with Linux filesystems. I don't know if it would be suitable, but one thing you may try would be to add swap on SSD and tune the `swapiness' Linux kernel parameter (sysctl vm.swapiness)

Lucas Kauffman
  • 16,818
  • 9
  • 57
  • 92
zecrazytux
  • 639
  • 3
  • 7
  • 1
    Swap on SSD won't help file performance - the kernel never uses swap space for page cache... – James Dec 08 '09 at 09:28
1

I don't think there's a simple way to do this on Linux yet. ZFS is available as a userspace filesystem, but it's not very good. Some ZFS clones are on their way, but as far as I know nothing is ready for production.

Perhaps you could consider a BSD with ZFS?

Roy
  • 4,256
  • 4
  • 35
  • 50