1 Reply Latest reply on Dec 10, 2008 10:38 AM by apdo

    performance hibernate vs EJB3

    apdo Newbie

      I know jboss EJB3 use hibernate technology.

      Should we expect identical peformance using EJB3 or hibernate (both behind slsb).

      I expect the answer to be yes. However, I'm performing some testing and I'm getting better performance using hibernate. Is this possible or my tests are incorrect? According to me both tests use the same configuration. I have configure second-level cache. I have test with and without query cache.

      Test 1: insertion of 100000 objects with relations.
      for insertion my hibernate test perform 25% faster than with EJB3.

      Test 2: read 100000 objects
      also faster by about 25%.

      Test 3: read 1000 objects
      I got similar performance.

      I must do something wrong to get different results with both API but I would like to have the point of view of others.


      An Phong Do

        • 1. Re: performance hibernate vs EJB3 vs EJB2
          apdo Newbie

          I have perform further testing. for hibernate and EJB3, I have enable second level caching and query caching. Hopfully, my configuration are correct for my result to make sense.

          my test was perform on jboss 4.2.3 GA

          entities used in my test:
          Account, Role
          There is a relation n to M between role and Account

          Test 1: insertion of 100 roles with 1000 accounts in each roles:
          For the insertion I have tested with cache enable and disable
          EJB2: 29 seconds
          EJB3: 109 seconds (cache enable), 97 seconds (cache disable)
          hibernate: 76 seconds (cache enable), 72 seconds (cache disable)

          test 2: get all account (100000 account):
          EJB2: 5,6 seconds
          EJB3: 3,6 seconds
          hibernate: 3,7 seconds

          the objectif of this post it to have confirmation that my result are acurate and to know if there is configuration error that I do that affect the performance of my EJB3 and hibernate test. I was especially surprise to see the performance of the insertions using EJB2 compaire to result with EJB3 and hibernate.

          If there is somebody that know which type of configuration would allow me to get the same kind of performance on insertion with EJB3/hibernate than with EJB2, it would really appreciate to ear from you.

          thank you,

          An Phong Do