Using JDG as data cache and as second level cache for Hibernate
oresistemas Dec 19, 2013 2:01 AMHello. I have four JBoss EAP (with support) servers and I want to ask you some questions, about how to increase the system performance with Infinispan.
A- Two JBoss servers have a Java application which uses Hibernate: Infinispan is used to make second-level cache in Hibernate.
B- The other two JBoss servers have some web services that make queries to the database and retrieve information, some of this information changes rarely, such as catalogs and configurations. These services also use infinispan as second level cache. A route in JBoss Fuse uses this web services.
We plan to disappear the web services and migrate this functionality to the routes already created in JBoss Fuse to avoid latencies in the invocation of the web service.
The first question : For the situation described in point A. Which is better? Use a cluster of Data Grid? or use an embedded Inifinispan ? I am assuming that we will pay a new license but the better performance justify the payment of the new license. But this solution have pros and cons: Firstly, with the Data Grid, the system prevents stale data because each node share the same information. But on the other hand I read that is not desirable to have a Data Grid when it is used as a second-level cache. This is a consequence of the latencies between the communication of the Data Grid Nodes. What do you recommend?
Second question: If I migrate the code of the web services to JBoss Fuse, what strategy would you suggest me? to take advantage of the Data Grid. I was thinking in a business component which takes the data of the configurations and catalogs from the cache: If the data is not found in cache, the process makes a query and retrieves the information from the database, sends info to the JBoss Fuse and also stores the data retrieved in the cache. The second time the process will find the information in the cache. Any idea of a better strategy ?
Third question : Is there a way to the hibernate cache and the JBoss Fuse route to share the same info and the same cache container? I think this is not possible because these are different ways to use the cache . I think I should have two different containers, each one running their own eviction and expiration timeout. Is that correct?