EHcache in clustered environment - ehcache

We plan to use Ehcache in our application that resides in a cluster. However we do not want to use Terracotta SA, what are the other options for cache replication across all the servers in cluster?

The quick answer is: No.
With Ehcache 2 you could, but it wasn't really reliable. With Ehcache 3, the clustered is done using a terracotta server. This has always been the most reliable way.
Note that the terracotta server is open source.

Related

spring security redis token store in clustered redis

I am trying to deploy a spring-security server, with Redis as token store.
In order to have some redundancy in Redis, we want to deploy it as a cluster.
The problem is Jedis, which is used by spring security as underlying library, doesn't support pipelining in cluster mode, but spring security uses pipelining.
My question is how can I solve this situation. More precisely:
1- Should I use another mode of deployment form Redis? What actually works.
2- Can I somehow force spring security to use reddison for connecting to Resid?
Please adivse.
If you want redundancy, use replication (master/slave) not cluster.
If you have more data than RAM on a machine, use cluster.
If you have more data than RAM on a machine and want redundancy, use cluster with replication.
Jedis supports replication with sentinel, so give that a go unless you have a lot of data. Some more info on usage here: https://github.com/xetorthio/jedis/issues/725

Where Infinispan store cache data?

What's the difference between infinispan local cache and distributed cache. I know that in local cache no cluster can be formed whereas in distributed cache we can form the cluster. My doubt is whether the distributed cache data will store in our running application heap or external to the application. Also, whether it is possible to obtain the data stored in infinispan running in one jvm by application running in another jvm.
Infinispan stores the data in the application heap. It also can persist the data if you configure a CacheStore (for example a database). You have the details here: Infinispan Persistence
About the second question: yes, Infinispan know where the data is stored and fetches from other nodes (or jvms) if no copy is available local. If you need more details, you can check the documentation: Infinispan Clustering

Cache Replication in Clustered Environment using EHCache JGroups

I am using EhCache framework to cache application data and thinking to use JGroups cache replication to replicate cache in a clustered environment.
Is it really an industry standard for cache replication in clustered environment? Or, there can be other better options that I should think about. Please notice that I am not using any centralized cache server at this point of time. I have already done POC on JGroups Cache Replication. Could you please share your experience in terms of its robustness and major concerns? What are the pros cons of using JGroups for cache replication?
I am using Jgroups for clustering various application nodes. We have our own cache implementation which uses the underlying Jgroups for data replication/distribution. So far it is working fine without issues.
Could you please check 'infinispan'. It's a distributed cache which uses Jgroups for handling cluster.

enable hibernate app to use clustered hazelcast

our prod environment architecture is decided to be like this:
2 machines that each of them have 2 tomcat instances (on vm). there is spring web app with hibernate running on tomcat.
there are also 2 db instances distributed to both machines.
so, we think that hazelcast fits this achitecture well. hazelcast will be second level cache for hibernate, it will manage clustered cache over db instances.
we installed hibernate server and defined our clusters on it.
i've searched offical hazelcast doc and several sites but i couldnt find the way to configure hibernate to use this hazelcast server as L2 cache.
we dont want to change our existing app. we'll keep using hibernate as it is. is it possible? if so, how we can configure hazelcast server on our web app?
I think it is important to understand that your probably don't want to have a standalone Hazelcast cluster/server; what you normally do is to embed Hazelcast within your application.
Like Miko said, you can just enable Hazelcast to be used as second level cache; no need to make any fundamental changes.
I also don't understand what you mean with 'hibernate server', because Hibernate is just an OR mapper library and has no concept of server.
So can you tell a bit more what you want so we can help you out?

can I use other distributed cache in place of jboss cache for session replication in jboss

I am using jboss-cache for session replication in jboss 4.0.4. How do I use a different distributed cache(Terracotta or any other) in place of jboss cache?
You may need to repackage jars and configuration in your jboss server, but Tomcat has its own clustering and session replication support. Not that I recommend this approach. Any specific reason you don't want to use the built in session replication ? You may also find improvements in clustering and session replication in later versions of JBoss 4.x.
Here is documentation for Terracotta For Web Sessions. If you disable clustering in your JBoss server and implement this, you should be good to go.

Resources