Differences between Ehcache 3 OffHeap storage and BigMemory - ehcache

In Ehcache 2.X offheap storage is available using Terracotta's BigMemory commercial product. However, since Ehcache 3 it seems offheap storage is free.
I wonder if BigMemory product has moved to Ehcache 3 and if they are different product, what are the differences between them?
Thanks,
References:
Offheap storage in Ehcache 2.X using BigMemory: http://www.ehcache.org/documentation/2.8/get-started/storage-options.html
Offheap storage in Ehcache 3: http://www.ehcache.org/documentation/3.0/caching-concepts.html#storage-tiers

BigMemory is the commercial name of the product that is Ehcache + Terracotta clustering + offheap memory and other enterprise only features such as security to name one.
Offheap is the name of the technology that allows to use memory in the java world which is not under the control of the garbage collector.
Offheap was open sourced by Terracotta in early 2015 which enabled to have again an open source clustering solution for Ehcache. This was the main feature of Ehcache 2.10.0 which worked with Terracotta server 4.3.0, which uses offheap for the server side storage.
Ehcache 2.x does not have the offheap feature available in open source. However, Ehcache 3.x does have it. The main reason for keeping that difference is around engineering resources and the will to promote newer versions of the library.
The underlying offheap implementation that was open sourced is effectively what has been used inside the Terracotta commercial products for a number of years and is thus a production tested library.
Note: I work for Terracotta on Ehcache and related libraries / products.

See the source code. I see Ehcache 3 uses Terracotta library internally which is licensed under Apache.
Ehcache 3 offheap class.
Terracota lib.
import org.terracotta.offheapstore.MetadataTuple;
import org.terracotta.offheapstore.Segment;
import org.terracotta.offheapstore.concurrent.AbstractConcurrentOffHeapCache;
import org.terracotta.offheapstore.pinning.PinnableSegment;
import org.terracotta.offheapstore.util.Factory;

Related

Ehcache vs BigMemoryMax for Distributed caching

I want to try Ehcache in distributed form. Can someone suggest me if EHcache (Not the BigMemoryMax) works in distributed mode.
I am looking for only open source product. I am not looking to buy a Bigmemory Max or Terracota server, which will give me a off heap access, which i dont need as of now.
If so, please provide the version, url and some guide/examples to implement distributed Ehcache.
Thanks...
Ehcache website is your best starting point:
Ehcache 2.10.x has open source clustering support with Terracotta 4.3.x
Ehcache 3.1.x has open source clustering support with Terracotta 5

Difference between different type of caches and their significance

What is the difference between the Ehcache and Guava Cache? In which scenarios would I use which type of caching?
Note: I am a developer working on Ehcache
The answer to your question depends on which features your cache needs to have inside your application.
Guava caches have all the basic caching features.
Ehcache has more advanced features - see 2.x line or upcoming 3.x line
Multi tier caching (disk in 2.x, offheap + disk in 3.x)
Clustering (2.x for now, soon in 3.x)
Refresh ahead or scheduled refresh (2.x for now)
JSR-107 API
So my advice is to look at your needs, play with both and then decide.

Why everyone recommend to avoid use EHCache as a distributed cache in Play 2.x?

I want to cluster EHCache in Play Framework 2.x web application in several node. Why everyone recommend to avoid to use EHCache as a distributed cache in Play 2.x clustered web application?
I use nginx proxy to serve request across Play node and i want to make default EHCache of each node share its content.
Well according to this EHCache page, using EHCache in distributed mode is a commercial product. So if you want to use a free distributed cache, you need something different like Memcached or Redis.
My experience deploying a (Java)Play 2.2.3 to Amazon EC2 was terrible with EHCache. It requires a few workarounds with the localhost resolve (going su for each of your nodes - hard work when you have a few dozens of servers) and regardless, being free only for standalone version without ostensively letting us know upfront is a big no-no for me. I'm done with EHCache.
Edit: moved to Redis in 2015 (thanks #Traveler)
I am not aware of any Play Framework issues here, but the use of ehcache 2.x should fine as you can set it up with JGroups (faster than RMI) and use invalidation mode (infinispan slang).
Invalidation is a clustered mode that does not actually share any data at all, but simply aims to remove data that may be stale from remote caches. This cache mode only makes sense if you have another, permanent store for your data.
In ehcache 2.x you can set up invalidation mode with replicatePuts=false in your jgroups config.
In ehcache 3.x they do not have such a mode. You have to set up a commercial Terracotta server which is a distributed cache. So all date is moved between nodes and the terracotta server.
We tried it once and failed terribly.
As ehcache2.x is no longer active we just switched to Infinispan which has all features of ehcache2.x and a lot more.
So my recommendation: Use ehcache 2.x or infinispan. Do not use ehcache 3.x

OpenJPA cache vs ehcache plugin

openjpa comes with its own cache implementation. But it will also easily integrate with ehcache and other third-party cache providers.
What are the main advantages of using ehcache vs OpenJPA's implementation? is it a scalability issue?
Thanks
Ehcache can run in a distributed mode which is more scalable and the default OpenJPA cache implementation is limited by the size of the JVM's memory. I believe that running with the default cache you will see much better performance that running with a distributed ehcache.

search api for ehcache

I have just checked the Terracotta EHCache and found the open source version has not supporting the search queries on the cache. I just tried with small application but it is clearly throwing exception like it is supporting only on enterprise version. Is there any open source alternative available to search on Ehcache?
Search is only supported as part of the OS product with unclustered caches.
To use Search with Terracotta clustered caches, you do require the EE version of the product.
If you use EhCache standalone (no cluster) and not using BigMemory Terracotta feature, then you don't need Terracotta and search API will work. Perhaps you have terracotta jars on your classpath that interfere....make sure you don't have terracota jars. Also in your ehcache.xml make sure you don't enable terracotta by providing <terracotta> xml tag.e.g.
<cache name="MySearcheablePOJO" eternal="true">
<searchable>
<searchAttribute name="attr1" />
<searchAttribute name="attr2" />
<searchAttribute name="attr3" />
</searchable>
<!--<terracotta> NOTICE ITS COMMENTED -->
</cache>
regarding any other alternative for cache with search ... perhaps you can try using Apache SOLR which is based on Lucene indexing engine. Otherwise not much choice out there...

Resources