How to setup tree cache in tc server - caching

I want to migrate an aplication which is currenty runnung in jboss 7 to tc server 2.9.6. In jboss we were using infinispan tree cache for caching. Is it possible to set up the same for tc server or I have to use any other caching techniques in tc server ?

Migrating projects from one container to another is often problematic. Not as much with Infinispan
This article(https://dzone.com/articles/how-configure-infinispan) is about configuring Infinispan, using Transaction Manager for demarcating transaction boundaries, while keeping the data both in a memory and relational database.

Related

How can I achieve local caching using Spring boot?

I am trying to setup a spring boot application and looking for options to store the small data in the local cache and then this local cache interacts with Redis server which will be on google cloud platform. This local cache can be shared across multiple nodes. I see Redis pro can help to achieve this but that is not free. Is there any open source option I can use? Or any other way I can set this up in Spring boot? How can I set this local cache which syncs up with the central cache? Any suggestions please?
You can use Redisson https://github.com/redisson/redisson/wiki/14.-Integration-with-frameworks/#1421-spring-cache-local-cache-and-data-partitioning. It's available in the Pro version.
If you would like to implement it by yourself, you would need to implement custom CacheManager that first looks up entries in local cache (implemented likely with something smarter than a HashMap, like Caffeine, if entry not found goes to Redis based CacheManager and then depending on the result puts the data to Caffeine cache.
For storing data in Redis and making sure all nodes are in sync, you can use Redis Pub/Sub mechanism to notify each connected node to update local cache.
Spring Boot for Apache Geode (SBDG) offers client-side caching, or what is commonly referred to as "Near Caching". See here.
HISTORY
Apache Geode is an open source software (OSS), In-Memory Data Grid (IMDG) technology, having an Apache 2 License. Indeed, it can be much more than a cache if need be, but fits perfectly well in the caching use case, at any layer in the application architecture (Web, Service, Data).
The commercial version of Apache Geode is VMware Tanzu GemFire, built on Apache Geode source with support from VMware, if needed. But, to use Apache Geode, is completely free.
In fact, the original Spring Cache Abstraction was inspired by Costin Leau's development (original lead & creator) of Spring Data GemFire, which has been replaced by Spring Data for Apache Geode (SDG), to focus on the OSS offering. (See here/alt-here, then here, as well as from Boot).
SBDG is an extension of SDG to give users of Apache Geode (or alternatively, VMware Tanzu GemFire) a proper and first-class experience using Apache Geode in a Spring context, and specifically with Spring Boot features (e.g. auto-configuration). That is, SBDG is a special extension of Spring Boot catered specifically to Apache Geode to handle a variety of application concerns (like caching) that is owned and maintained by the Spring Team, itself.
SBDG is even capable of handling several caching patterns in addition to "Near Caching". See the topic of caching in general.
Finally, SBDG also includes Spring Session for Apache Geode (SSDG) to handle your Web, HTTP Session state caching concerns independent of you Web container (e.g. Tomcat) using Apache Geode as the caching provider for the HTTP Session state. It is, of course, built on Spring Session core (see here).

Can we use Managed Coherence Servers (MCS) feature with single Weblogic cluster to deploy application and coherence GAR?

We have a Weblogic cluster with set of managed servers where we have already deployed our enterprise application which heavily involved in database transactions. Recently we have migrated to Weblogic 12c and we have a proposal in pipeline to use Oracle Coherence to enable a caching layer so that we can improve application performance.
After doing a research we found that Managed Coherence Servers (MCS) feature in WLS 12c supported by creating additional storage enabled cluster which we can be used to deploy the GAR.
However increasing memeory in the production set up in costly to create a new cluster hence before proposing it I want to know whether Oracle Coherence feature can be used without creating a new cluster but without compromising MCS features?
You can create Oracle Coherence caches in the same cluster where application EAR is deployed. Follow this link on how to create the caches Pack GAR with Application EAR
But it always make sense to have your caching layer separate from your application layer. As caches also use the Heap Memory to store/cache objects. When your application and the cache are deployed in the same server (same JVM), they will have to share the heap space among themselves. And as far as i know, there is no clear way to define separate zones in heap memory for different application running on same JVM.
Hence there is a high probability for any of the application to consume more heap and make the other to starve and ultimately causing Out of Memory exceptions. Plus capacity planning for Coherence caches will also be a nightmare as you have to consider the memory consumed by the application too.

How to enable cache server JNDI lookup support in Coherence 12.2.1?

I am trying to access Coherence 12.2.1's cache (deployed in data tier) from application tier (deployed in application tier) that staying same Coherence cluster with different WebLogic clusters.
Oracle stated:
A component-scoped JNDI tree can be used in EJBs, servlets, or JSPs to reference the NamedCache.
To use a component-scoped JNDI lookup, define a resource-ref of type com.tangosol.net.NamedCache in either the web.xml or ejb-jar.xml file. Example 3-2 illustrates a <resource-ref> stanza that identifies myCache as the NamedCache.
in https://docs.oracle.com/cd/E24329_01/web.1211/e24442/coh_wls.htm#COHWL117
I developed a Coherence application and deploy it into local storage enabled WebLogic server (coherence managed server). I used Application Lifecycle Listener to access and initialise cache, it works fine.
I can find the cache was populate up in Coherence cache server by using VisualVM, please see attachment.
But unfortunately, I can't find any thing about the cache in my WebLogic managed server JNDI tree, Please find attachment.
I tried to find out a way to enable Coherence cache server (it was integrated into WebLogic 12c) support JNDI look up.
I found something like this:
<cache-config xmlns:jndi="class://com.oracle.coherence.environment.extensible.namespaces.JNDINamespaceContentHandler">
...
</cache-config>
But unfortunately again, com.oracle.coherence.environment.extensible.namespaces.JNDINamespaceContentHandler was removed from WebLogic 12c. Which means there is no way to enable Coherence data cache JNDI name configuration in Coherence 12cR2.
Any advice please!!
Were you able to create the ConnectionFactory, Outbound pools, etc ?
I suggest you take a look at this post here. It should help you out.
Hope it helps !!

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