Question

Can anyone recommend a lightweight, fast, and hopefully stable B-tree (or similar) library for Java?

Essentially I'm looking for an on-disk map; something along the lines of BerkeleyDB JE, except I don't need transactions, am fine with read-only concurrency, and need it to be about 1/10th the size (BSD or Apache license would be nice, too).

Needs to be pure-Java, so no Tokyo/Kyoto Cabinets.

Implementing relevant Collections interfaces would be a plus (alternatively, templated interfaces for primitive types would be nice too).

JDBM looks pretty good, but it seems to have been abandoned in 2005 (at 1.0, no less).

There's also DiskBackedMap, but they released an alpha a year ago, and nothing since.

Anything else out there? Or any experiences with the above-mentioned ones?

Things I'm NOT looking for:

  • In-process relational DBs (so no H2, Derby, SQLite, etc)
  • Distributed key-value stores (no Redis, Memcachedb, Cassandra, Voldemort, Dumbledore, or whatever)
Was it helpful?

Solution

There is a fork of JDBM that might be of interest to you.

See http://www.kotek.net/blog/jdbm_2.1_and_beyond

GitHub: https://github.com/jankotek/JDBM3

Also,

Email: jdbm@googlegroups.com

Web: http://groups.google.com/group/jdbm

RSS: http://groups.google.com/group/jdbm/feed/rss_v2_0_msgs.xml

EDIT:

JDBM4 was renamed to MapDB

OTHER TIPS

Modern projects worth mentioning:

  • LMDBJava allows to use LMDB from Java. LMDB is not exactly B-tree, but it's a tree-like structure, i. e. always sorted.
  • If you don't the sorted property, Chronicle Map is the most efficient random-access unordered persisted off-heap key-value store for Java now

https://github.com/jankotek/MapDB might do part of what you want. That library provides several persistent list, set and map implementations, including a b-tree map.

A late contribution, I know. I myself don't need the excitement of choosing a Java DBM library. I need one merely to minimize memory usage in certain cases. (For actual persistence I'd use JPA.) There currently are 4 different JDBM projects in various states.

Luckily the Apache directory server comes with a JDBM library and my exciting times seem to be gone forever! The library can be used separately and it seems to be based on one of the four implementations. It's also on MVNRepository.

<dependency>
    <groupId>org.apache.directory.server</groupId>
    <artifactId>apacheds-jdbm</artifactId>
    <version>2.0.0-M5</version>
</dependency>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top