2 Replies Latest reply on Jan 22, 2015 4:29 PM by execretor

    Infinispan put operation very slow

    execretor Newbie

      Hello,

       

      i have a problem with the infinispan subsystem used in a cluster environment.

       

      I want to use one replicated-cache with two JBoss Nodes (two different machines with RHEL) connected in the same network without firewalls.

       

      I have deployed one writer.jar in the A node and one reader.jar in the B node. The A node must insert 100000 entries (Integer value type) and the B node must read the size of the cache every N seconds. Note: This is a simple perfoamnce test.

       

      But, the result of my test show that to insert in the cache 10000 records the A node takes about 5 seconds, a very long time. Why? How can i boost this operation?

       

       

      My JBoss XML configuration is as follow:

       

      <cache-container name="mycache" default-cache="rlt">

          <transport lock-timeout="60000"/>

          <replicated-cache name="rlt" mode="ASYNC">

              <locking isolation="REPEATABLE_READ"/>

              <transaction mode="NONE"/>

              <eviction max-entries="-1"/>

              <expiration max-idle="-1"/>

          </replicated-cache>

      </cache-container>

       

       

      Regards,

      Lorenzo

        • 1. Re: Infinispan put operation very slow
          Radim Vansa Master

          Seems like you're using HotRod protocol to access the cache, right? Although the cache itself is async according to your configuration, the call (RPC) to server is synchronous, so you have to wait until one write finishes before starting another one.

          If you care about total throughput, use many (hundreds) concurrent connections to the server, and distributed those 100k entries between the threads writing to the cache. You can do that ~automatically using putAsync, but the threadpool has only about 20 threads by default.

          1 of 1 people found this helpful
          • 2. Re: Infinispan put operation very slow
            execretor Newbie

            Thanks for your help,

             

            with your method and using the default thread pool configuration, insert of 300k entries with 2 nodes finish in 24 seconds. Very good.

            But there is another problem using putAsync method. This is my code:

             

                           TransactionMamager tman = db.getTransactionManager();              

                           for(int i = 0; i < 300000; i++) {

                                try {

                                     tman.begin();

                                     db.putAsync(i, i);

                                     tman.commit();

                                } catch(....) {

                                     ....

                                }

                           }

             

            The execution of tman.commit() infinispan raise an exception with the information of an invalid state of the transaction(Probably because with putAsync i cannot determine the correct moment when the data is written).

            So, how can i use transactions with the putAsync method?

             

            Regards,

            Lorenzo