4 Replies Latest reply on Sep 26, 2016 10:58 AM by pferraro

    What is the best way to separate Wildfly AS JVM from Infinispan cache JVM?

    gvwolf3d

      We are running a Wildfly cluster (8.2.0.Final). To separate the Wildfly JVM from the Infinispan cache (JPA entity + custom) we have also

      a Infinispan cache server running at each host building a Infinispan cluster. So we can tweak and monitor the AS and the cache JVM separately.

       

      To achieve this we configured a cache container with an invalidation cache having a remote store like this:

        

      ...
                   <cache-container name="hibernate" default-cache="entity" module="org.hibernate.infinispan">
                      <transport lock-timeout="60000"/>
                      <invalidation-cache name="entity" mode="SYNC">
                          <eviction strategy="LRU" max-entries="1000"/>
                          <expiration lifespan="45000" max-idle="30000"/>
                          <remote-store cache="hibernateExtern" socket-timeout="60000" tcp-no-delay="true" remote-servers="local-cache-server" fetch-state="false" passivation="false" preload="false" purge="true" shared="true"/>
                      </invalidation-cache>
                      <replicated-cache name="timestamps" mode="ASYNC"/>
                  </cache-container>
      ...
      

      But some things doesn't work optimal:


      We have to configure a cache also in the Wildly Cluster (max-entries cannot be zero, local-cache isn't an option too).

      So as a result we get a Wildly cache cluster, holding only some entries and the Infinispan cache cluster as main cache.

       

      We rely on Wildly 8.2.0.Final as this does not work any more by 10.0.0.Final and above.

      See [WFLY-6596] WrongClassException when using infinispan as remote-store for hibernate entity cache - JBoss Issue Tracker .

      Because the ticket is ignored for the last months I think our way is not the right one to go.

       

      So the question is, what is the best way to separate AS and cache JVM from each other? Do you have other ideas?

      How do you run a separated JPA entity cache?

        • 1. Re: What is the best way to separate Wildfly AS JVM from Infinispan cache JVM?
          rhusar

          We rely on Wildly 8.2.0.Final as this does not work any more by 10.0.0.Final and above. See [WFLY-6596] WrongClassException when using infinispan as remote-store for hibernate entity cache - JBoss Issue Tracker . Because the ticket is ignored for the last months I think our way is not the right one to go.

          The issue has not been assigned, probably because the component hasn't been set at the creation time letting Jira auto-assign to the right person, fixed now.

          • 2. Re: What is the best way to separate Wildfly AS JVM from Infinispan cache JVM?
            gvwolf3d

            Thank you, Radoslav!

            • 3. Re: What is the best way to separate Wildfly AS JVM from Infinispan cache JVM?
              smarlow

              Thanks for posting this here, where more people will see it.  This is an important use case that I know is desired to have working.  I'm not exactly sure of where to look and am too busy currently to try the test case.  I'd like to better understand why the problem is occurring.  I'm curious if the org.hibernate.WrongClassException cause could be in Hibernate ORM or remote Infinispan cache.

               

              I know that Hibernate has TRACE logging and Infinispan does as well but I'm not sure if either has TRACE logging that would help identify the cause of this problem.  sebersole can you look at the details in https://issues.jboss.org/browse/WFLY-6596 and let us know what the likely cause is?

              • 4. Re: What is the best way to separate Wildfly AS JVM from Infinispan cache JVM?
                pferraro

                Gunther v. Wolffersdorff wrote:

                [...]

                But some things doesn't work optimal:

                 

                We have to configure a cache also in the Wildly Cluster (max-entries cannot be zero, local-cache isn't an option too).

                So as a result we get a Wildly cache cluster, holding only some entries and the Infinispan cache cluster as main cache.

                Using a local cache would result in stale reads on failover.  You must use an invalidation-cache with this configuration. The WF cluster is required to broadcast invalidation messages when an entry in the local cache is updated.  I'm not sure why you would want to eliminate this cache layer - as it will be a couple orders of magnitude faster than a remote infinispan cache alone.

                We rely on Wildly 8.2.0.Final as this does not work any more by 10.0.0.Final and above.

                See [WFLY-6596] WrongClassException when using infinispan as remote-store for hibernate entity cache - JBoss Issue Tracker .

                Because the ticket is ignored for the last months I think our way is not the right one to go.

                 

                So the question is, what is the best way to separate AS and cache JVM from each other? Do you have other ideas?

                How do you run a separated JPA entity cache?

                The primary issue with your configuration is that WF's JPA 2LC will use a cache per region.  If you have multiple regions, you must make sure they use a unique cache configuration - since otherwise they will try to share the same remote cache, and thus encounter key collisions (as hibernate does not use the region name to compose the cache key).

                You must also make sure that your remote Infinispan cache uses storeAsBinary for both cache keys and values.