1 2 3 Previous Next 35 Replies Latest reply on Nov 14, 2011 11:23 AM by asimoes

    Infinispan on Jboss 510 - Low performance issue or missing conf?

    asimoes

      Hi!

       

      I successfully managed to put Infinispan running on Jboss 510 AS.

      I had followed this post.

       

      I had done some performance tests with a simple test class.


      This are the results:

       

      No cache enabled:      200 requests -> duration = 2406 ms

      Ehcache:                    200 requests -> duration = 1504 ms

      Infinispan                    200 requests -> duration = 13204 ms

       

       

      My configurations are:

      One Jboss node

       

      java -version

      java version "1.6.0_26"

      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)

      Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

       

      uname -a

      Linux ubuntu 2.6.35-30-generic #59-Ubuntu SMP Tue Aug 30 19:00:03 UTC 2011 x86_64 GNU/Linux

       

      sysctl

      net.core.wmem_max=2097152

      net.core.rmem_max=52428800

       

      Jboss 510 with some jvm tune (just memory and gc)

       

      database

      Oracle 11g

       

      JPA Query

      @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
      
      @NamedQueries({
        @NamedQuery(name = "TUsers.findAll", query = "select o from TUsers o"
            ,hints={@QueryHint(name="org.hibernate.cacheable", value="true")}),
      

       

      Table users only have 2 entries.

       

       

       

      Maybe I missed some confs, but why it take so long on infinispan?

        • 1. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
          asimoes

          I accidentally pressed assumed answered, and now i can't change it.

          Sorry, but i still waiting some tips.

          • 2. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
            filipe_c

            Hi,

            nobody there check this, this is true?

            filipe

            • 3. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
              manik

              What are you using Infinispan for?  Hibernate/JPA 2nd level cache?

              • 4. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                asimoes

                Hi.

                Yes, i'm using it as 2LC

                 

                This is my persistence.xml

                • 5. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                  galder.zamarreno

                  First of all, to avoid confusion, I'd remove all hibernate.cache.region.jbc2.* properties that belong to another cache provider.

                   

                  I think the key here is hibernate.cache.infinispan.use_synchronization which you have set it to false. We've seen performance increase quite noticeably when that parameter is true. In fact, true is the default value and so I'd remove this property altogether. Let the Hibernate/Infinispan layer decide what's best here

                   

                  Tbh, you really need these params:

                   

                  <property name="hibernate.cache.use_second_level_cache"value="true" />
                  <property name="hibernate.cache.use_query_cache" value="true" />
                  <property name="hibernate.cache.region.factory_class"value="org.hibernate.cache.infinispan.InfinispanRegionFactory" />
                  <property name="hibernate.transaction.manager_lookup_class"value="org.hibernate.transaction.JBossTransactionManagerLookup" />
                  

                   

                  The rest of hibernate.cache.infinispan.* I'd leave out until you have the performance you want, and then you can tweak it further.

                  • 6. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                    asimoes

                    Hi.

                    You are right, hibernate.cache.region.jbc2 do not belong here!

                    I done what you said, but the results are the same...

                    Any other clue?

                    • 7. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                      galder.zamarreno

                      Hmm, that's weird. We can try isolating the problem, for example disabling query cache and see what the results are like.

                       

                      Maybe you wanna upload your app and test class here?

                      • 8. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                        asimoes

                        Ok.

                         

                        I thing is better send the all project zipped.

                        • 9. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                          asimoes

                          In the previous post i forgot to send you the client source... Sorry.

                           

                          Meanwhile I made some tests. Here are the results:

                           

                          *********************               JBOSS CODE          ***************************

                           

                          public List<TUsers> getTUsersFindAll(int firstResult,int maxResults) {
                          
                              long start = System.currentTimeMillis();
                              Query query = em.createNamedQuery("TUsers.findAll"); 
                          
                              if (firstResult > 0) {
                                      query = query.setFirstResult(firstResult);
                              }
                              if (maxResults > 0) {
                                  query = query.setMaxResults(maxResults);
                              }
                          
                              List result = query.getResultList();    //Table users has two users!!!!
                          
                              System.out.println(System.currentTimeMillis() - start);
                              return result; 
                          
                          }
                          
                          

                           

                           

                           

                          public List<TUsers> getTUsersFindNothing(int firstResult,int maxResults) {
                          
                              long start = System.currentTimeMillis();
                              List<TUsers> usrlst = new ArrayList<TUsers>();
                          
                              for(int i=0;i<2;i++) {
                                  usrlst.add(new TUsers());
                              }
                          
                              System.out.println(System.currentTimeMillis() - start);
                              return usrlst;
                          
                          }
                          

                           

                          *********************           EXTERNAL CLIENT CODE      ***************************

                           

                          private void makeNRequests(int numbReq, boolean findAll) {
                          
                              for (int j = 0; j < numbReq; j++) {
                                  List<TUsers> result;
                          
                                  if (findAll)
                                      result = userFac.getTUsersFindAll(-1, -1);
                                  else result = userFac.getTUsersFindNothing(-1, -1);
                          
                                  if (result == null || result.size()<1)
                                      System.out.println("null result!!!");
                              }
                          
                          }
                          

                           

                           

                           

                           

                          *********************           TEST (ABSOLUTE BEST TIME RESULTS)    
                          ***************************

                          #############      No cache enabled          #################

                          Infinispan_Example.jar

                          makeNRequests(200, true);      -> 2364 ms

                          [STDOUT] less than 5

                          makeNRequests(200, false);     -> 1701 ms

                          [STDOUT]  0

                           

                          InfinispanEar-1.0.ear

                          makeNRequests(200, true);      -> 2299 ms

                          [STDOUT] 1 or 0

                          makeNRequests(200, false);     -> 1761 ms

                          [STDOUT]  0

                           

                          #############      EHCACHE enabled         #################

                          Infinispan_Example.jar

                          makeNRequests(200, true);      -> 1750 ms

                          [STDOUT] 1 or 0

                          makeNRequests(200, false);     -> 1549 ms

                          [STDOUT]  0

                           

                          InfinispanEar-1.0.ear

                          makeNRequests(200, true);      -> 1760 ms

                          [STDOUT] 1 or 0

                          makeNRequests(200, false);     -> 1669 ms

                          [STDOUT]  0

                           

                           

                          #############      INFINISPAN enabled         #################

                          Infinispan_Example.jar

                          Not possible!

                           

                          InfinispanEar-1.0.ear

                          makeNRequests(200, true);      -> 10703 ms

                          [STDOUT] 1 or 0

                          makeNRequests(200, false);     -> 1658 ms

                          [STDOUT]  0

                           

                          It seems like a infinispan specific problem!!!

                          • 10. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                            asimoes

                            Another thing.

                             

                            This problem occurs when we call TUsersFacade EJB from its remote interface or when we call it from its local interface but inside another EJB

                             

                            If I run the previous test code makeNRequests(200, true); in the JBOSS server, and I call it directly from TUserFacadeBean I got 12 ms time

                             

                            but if I use injection in another bean on the server:

                               

                             @IgnoreDependency
                                @EJB(mappedName="TUsersFacade/local")
                                TUsersFacadeLocal userFac;
                            

                             

                            I got 9500 ms time!!!

                            • 11. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                              asimoes

                              I made some cpu sampling on JBOSS and i found that, in "low performance" case, there are a method that takes almost all cpu time ().

                              com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore.write_state()

                              • 12. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                                filipe_c

                                no ideas? 

                                • 13. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                                  asimoes

                                  @Galder Zamarreño

                                   

                                  Any clue about what i'm doing wrong?

                                  • 14. Re: Infinispan on Jboss 510 - Low performance issue or missing conf?
                                    galder.zamarreno

                                    Guys, I've said it before. You need to enable the use of synchronizations (as opposed to XA transaction)

                                     

                                    So either *enable use_synchronization*:

                                     

                                    <property name="hibernate.cache.infinispan.use_synchronization" value="true" />
                                    

                                     

                                    Or remove it alltogether! (default is true)

                                     

                                    Your zip file still says that's false, so XA transactions are being in use which result in storing transactions for recovery which does not make sense for 2LC.

                                     

                                    Stick to defaults that are there for a reason

                                    1 2 3 Previous Next