5 Replies Latest reply on Apr 17, 2006 2:46 PM by mijez

    Performance problem with returning values from StatelessSess

    mijez

      I've got the same problem:

      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=80658

      I'm using Hibernate.initialize(Children) instead of calling Entity.getChildren(). But result is the same. Any new ideas?[/url]

        • 1. Re: Performance problem with returning values from Stateless
          mijez

          I'll try explain my problem. Sorry about my english:)
          Here is method from my Stateless Session Bean:

          .......
          public Calculation getCalculationWithMappings(Long idCalculation) {
          log.info("getCalculations START ");
          Calculation calc = (Calculation) em
          .createQuery(
          "from Calculation calc where calc.idcalculation = :idcalculation")
          .setParameter("idcalculation", idCalculation).getSingleResult();

          for (Section section : calc.getSections())
          for (Item item : section.getItems())
          item.getItementries();

          log.info("getCalculations STOP");

          return calc;

          }
          ================
          Entity beans:

          @Entity
          @Table(name = "CALCULATION")
          public class Calculation implements java.io.Serializable {
          .... cut.....
          @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "calculation")
          @OrderBy("idsectionincalc")
          public List getSections() {
          return this.sections;
          }
          +++++++++++++++++

          @Entity
          @Table(name = "SECTION", )
          public class Section implements java.io.Serializable {
          ...cut


          @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "section")
          @OrderBy("iditemincalc")
          public List getItems() {
          return this.items;
          }


          ++++++++
          And deeper - > in Item itementries, in every itementry - rmsInstance, In rmsInstance collection mapping with fetch type EAGER.




          .......

          In my backing bean:
          CalculationAction ca = null;
          try {
          InitialContext ctx = new InitialContext();
          ca = (CalculationAction) ctx
          .lookup("WorkMonitor/CalculationActionBean/local");

          } catch (Exception e) {
          log.fatal("CalculationActionBean", e);
          }

          Calculation newCalc = ca.getCalculationWithMappings(...some Long value);
          log.info("initCalculationTree START");
          initCalculationTree(newCalc);


          And here is most important:
          21:13:17,331 INFO [CalculationBean] selectCalculation START

          21:13:17,346 INFO [CalculationActionBean] getCalculations START

          21:13:18,206 INFO [CalculationActionBean] getCalculations STOP

          21:13:30,253 INFO [CalculationBean] initCalculationTree START


          Whay returning this value takes so long. Fetching calculation from DB is fast ( value before getCalculations STOP and START)

          • 2. Re: Performance problem with returning values from Stateless
            mijez

            I'm trying to solve this, but now I think its a problem with returning huge values.

            Container process takes up 100% cpu-time for 12 seconds. It seems like the container is doing some heavy calculations before control is passed back to the client - value is return.

            I think this may be a BUG!!! Can anybody verify this?

            • 3. Re: Performance problem with returning values from Stateless
              mijez

              Do I have to post it to JIRA?

              • 4. Re: Performance problem with returning values from Stateless
                bdecoste

                Can you post (here or JIRA) all of your source and I'll take a look.

                • 5. Re: Performance problem with returning values from Stateless
                  mijez

                  Ok I found explanation for this long returning time. Now, because I only read from DB, I annotated my method in Stateless Session Bean with:

                  @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

                  Now, it's working quite fast. Thanks anyway.