Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 364
Jé Queue Avatar asked Feb 17 '11 17:02

Jé Queue


2 Answers

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

like image 116
Andrejs Avatar answered Oct 07 '22 19:10

Andrejs


I think SQLite is exactly what you want: Free (Public Domain), Single File Database, Zero-Configuration, Small Footprint, Fast, cross-platform, etc.. Here is a list of wrappers, there is a section for Java. Take a look to sqlite4java and read more on Java + SQLite here.

like image 44
JPelletier Avatar answered Oct 07 '22 21:10

JPelletier