title: In memory databases with LMDB
body: <p>I have a project which uses BerkelyDB as a key value store for up to hundreds of millions of small records.  </p>
  
  <p>The way it's used is all the values are inserted into the database, and then they are iterated over using both sequential and random access, all from a single thread.</p>
  
  <p>With BerkeleyDB, I can create <a href="http://pybsddb.sourceforge.net/api_c/db_open.html" rel="nofollow">in-memory databases</a> that are "never intended to be preserved on disk".  If the database is small enough to fit in the BerkeleyDB cache, it will never be written to disk.  If it is bigger than the cache, then a temporary file will be created to hold the overflow.  This option can speed things up significantly, as it prevents my application from writing gigabytes of dead data to disk when closing the database.</p>
  
  <p>I have found that the BerkeleyDB write performance is too poor, even on an SSD, so I would like to switch to <a href="http://symas.com/mdb/microbench/" rel="nofollow">LMDB</a>.  However, based on the <a href="http://symas.com/mdb/doc/group__mdb.html#ga32a193c6bf4d7d5c5d579e71f22e9340" rel="nofollow">documentation,</a> it doesn't seem like there is an option creating a non-persistent database.</p>
  
  <p>What configuration/combination of options should I use to get the best performance out of LMDB if I don't care about persistence or concurrent access at all? i.e. to make it act like an "in-memory database" with temporary backing disk storage?</p>