Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a open-source off-heap cache solution for Java?

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 solution which will work inside JVM without any JNI and C-backed solution.

like image 708
Tema Avatar asked Oct 09 '11 19:10

Tema


People also ask

Which is the best cache for Java?

Ehcache is an open-source implementation of the JSR-107, which is reported to be the most used Java-based cache (URL-2, 2020).

Which tool is a off-heap cache for the Java Virtual Machine?

Geode can be configured to store region values in off-heap memory, which is memory within the JVM that is not subject to Java garbage collection.

Does Java have cache?

The Java Object Cache provides caching for expensive or frequently used Java objects when the application servers use a Java program to supply their content. Cached Java objects can contain generated pages or can provide support objects within the program to assist in creating new content.

What is off-heap memory in Java?

The off-heap store extends the in-memory store to memory outside the of the object heap. This store, which is not subject to Java garbage collection (GC), is limited only by the amount of RAM available. Because off-heap data is stored in bytes, only data that is Serializable is suitable for the off-heap store.


1 Answers

There is a very good cache solution named MapDB(JDBM4 formerly). It supports HashMap and TreeMap But it is only application embedded. It also support persistent file based cache.

Example for off heap cache:

DB db = DBMaker.newDirectMemoryDB().make(); ConcurrentNavigableMap<Integer, String> map = db.getTreeMap("MyCache"); 

Or persistent file based cache:

DB db = DBMaker.newFileDB(new File("/home/collection.db")).closeOnJvmShutdown().make(); ConcurrentNavigableMap<Integer,String> map = db.getTreeMap("MyCache"); 
like image 75
Majid Azimi Avatar answered Sep 24 '22 00:09

Majid Azimi