Nikem
Nikem

Reputation: 5784

Embeddable disk-based key-value store

We are working on a project, that will be distributed using single jar file. We have a need for some key-value store with following properties:

  1. Embeddable into our jar file, so no additional installation.
  2. Can hold up to tens of millions pairs
  3. Memory efficient. That means less than 100M for 50M pairs
  4. Both keys and values are of simple types: long, int, small byte[]
  5. Free license for commercial use is a bonus
  6. We do not need concurrency, ACID or such advanced stuff.
  7. Amortized lookup time below 100 microseconds.

Any suggestions other than BerkelyDB or JDBM2/3?

Upvotes: 2

Views: 1236

Answers (2)

Michael McGowan
Michael McGowan

Reputation: 6608

GNU Trove offers a number of maps (e.g. TIntIntHashMap) that are more memory-efficient than standard Java maps because they use primitive types. I doubt you can get significantly more memory-efficient than this unless you know something about what you are storing. Trove is more or less LGPL, so it's probably safe for you to use. I don't know if it specifically meets your exact specifications, but I think it's worth trying when you can fit things in RAM.

When you might need to swap to disk, Ehcache is a good choice. You can specify that after a certain number of entries it will store values on disk (newly in version 2.5 you can specify after a certain amount of RAM is used if you don't know how the exact number of entries).

Upvotes: 3

Araejay
Araejay

Reputation: 222

Look at noSQL implementations, CouchDB, Cassandra and more are pretty good.

Do google search to compare, you will find what you want.

My favourite is mongoDb and unfortunately its not Java based

regards

Upvotes: 0

Related Questions