Single-file, persistent, sorted key-value store for Java (alternative to Berkeley DB)

Jé Queue picture Jé Queue · Feb 17, 2011 · Viewed 11.2k times · Source

Berkeley DB (JE) licensing may be a deal killer. I have a Java application going to a small set of customers but as it is a desktop application, my price cannot support individual instance licensing.

Is there a recommended Java alternative to Berkeley DB? Commercial or otherwise (good key-value store implementations can get non-trivial, I prefer to defer maintenance elsewhere). I need more than just a hash store as I'll need to iterate through subsequent key subsets and basic hash stores would O(m*n) that search and I expect the store to be ~50-60GiB on a desktop machine. Added benefit anyone that you can recommend that keeps its backing store in a single file?

Answer

Andrejs picture Andrejs · Feb 26, 2012

You should definitely try JDBM2, it does what you want:

  • Disk backed HashMaps/TreeMaps thus you can iterate through keys.
  • Apache 2 license

In addition:

  • Fast, very small footprint
  • Transactional
  • Standalone jar have only 145 KB.
  • Simple usage
  • Scales well up to 1e9 records
  • Uses Java serialization, no ORM mapping

UPDATE

The project has now evolved into MapDB http://www.mapdb.org