title: Key-value stores for medium to large values
body: <p>We have a system that stores (single-digit) millions of images, varying in size from 8KB to 500KB, median around 15KB, average 30KB. The total data set is currently around 100GB. We want to access the image based upon a hash of the image (this <em>can</em> be changed, but it needs to be computable from the image for the purpose of checking whether an image is already in the data store efficiently — images are processed such that two images are pixel-for-pixel identical iff they are byte-for-byte identical). Persistence is (obviously) important.</p>
  
  <p>At the moment we store them all as files within a directory — the listing of the directory are cached by the kernel, and actual file-reads are done as needed. As I understand it, the main advantage of key-value stores (versus using a filesystem as one) is reading smaller values, as the whole page can be cached, instead of just a single value. All the access currently comes from the web server (on an intranet) on the same server as the data, though we may move to checking whether keys exist from remote machines (mostly connected through 10GbE).</p>
  
  <p>There isn't any particular reason to change it, though with other major parts of the system changing, it seems worthwhile to re-consider the current approach.</p>
  
  <p>Given a workload whose reading is primarily (single) reads in insertion order and random (though quite possibly repeated) accesses to arbitrary keys, in addition to frequent writes (something of the order of magnitude 1:10 write:read), is there likely to be much advantage to moving to a key-value store from the filesystem?</p>