1 Reply Latest reply on Jun 7, 2014 3:11 PM by Wolf-Dieter Fink

    Using JDG as data cache and as second level cache for Hibernate

    CESAR O Newbie

      Hello. 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?

        • 1. Re: Using JDG as data cache and as second level cache for Hibernate
          Wolf-Dieter Fink Master

          1) There is no 'license' to pay. You pay for the subscription to get support, updates etc..

          But there is no difference, if you have an EAP server you need such JDG subscription for embeded and client/server mode.

          The decision what mode you use depends on your requirements, if you use embedded the data is stored in the EAP servers memory which might sounds faster, but as the entries are evicted you may reload it often and the latency if you go remote to a JDG instance is better.


          2) Don't know much about fuse, but in general if you don't have a database you might use such strategy to push content to the cache.