Is there any open-source alternative for Terracotta BigMemory?
Actually I didn\'t even manage to find any commercial alternative. I\'m interested in pure Java soluti
I am developing a solution to be much faster, but I wouldn't suggest you use it just yet as it just a proof of concept at this stage.
http://vanillajava.blogspot.com/2011/09/new-contributors-to-hugecollections.html
However if you have a specific requirement, it may be easier to code it yourself, to use direct ByteBuffers or memory mapped files.
e.g.
// using native order speeds access for values longer than a byte.
ByteBuffer bb = ByteBuffer.allocateDirect(1024*1024*1024).order(ByteOrder.nativeOrder());
// start at some location.
bb.position(0);
bb.put((byte) 1);
bb.putInt(myInt);
bb.putDouble(myDouble);
// to read back.
bb.position(0);
byte b = bb.get();
int i = bb.getInt();
double d = bb.getDouble();
You can do similarly for memory mapped files. Memory mapped files don't count towards you direct memory limit and don't use up swap space.
Are you sure BigMemory won't do the job for you?