2

I'd like to find simple storage engines or low-level databases, embeddable in Java. I.e. libraries.

They only have to be able to store bytes, really. Keys could be simply integers.

No querying required. I am investigating the idea of dealing with persistence or even implementing databases on top of such a simple foundation.

Of course, fast, lean, simple are good qualities.

(Wasn't able to use (create) additional tags: low-level, storage)

  • Java on what OS? – rrirower Feb 6 '15 at 16:51
  • @rrirower I am thinking pure JVM code, so OS shouldn't matter too much. Of course, there may be small differences in things like memory-mapping. – Jonas N Feb 6 '15 at 16:56
1

If you want a pure Java lib you can look on HeftyDB. If you are ok with native lib and Java wrappers there are many options:

2

H2 Database, MVStore

The pure-Java relational database engine, H2 Database, has an explicit key-value store called MVStore.

Each store contains a number of maps that can be accessed using the java.util.Map interface.

Both file-based persistence and in-memory operation are supported.

It is intended to be fast, simple to use, and small.

Concurrent read and write operations are supported.

Transactions are supported (including concurrent transactions and 2-phase commit).

Can even be used directly, without using JDBC or SQL.

Example code:

// open the store
MVStore s = MVStore.open( fileName );

// create/get the map named "data"
MVMap<Integer, String> map = s.openMap( "data" );

// add and read some data
map.put( 1, "Hello World" );
System.out.println( map.get(1) );

// close the store (this will persist changes)
s.close();
  • Checked it out a little. Log-structured storage, I like that. Can store Java arrays, so my requirement is met. Seems a little higher-level than I was aiming for, though; it can store many more data types. Cool feature: 'The MVRTreeMap is an R-tree implementation that supports fast spatial queries.' – Jonas N Jul 27 '17 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.