4 Replies Latest reply on Jan 31, 2006 5:14 PM by lafr

    Ways to tune Jboss CMP

    raviupasi

      I am facing some problem in CMP Bean performance tuning in Jboss.
      I am working on a project where we need to improve the performance of that application
      we are using Jboss 4.0.1. and oracle as DB
      when I click on some link it takes some 6 to 7 seconds to bring up the page
      what exactly is happening behind is it is firing some queries to get the metadeta from the DB and using that info
      it is loading that perticular page from some local file store..
      Now if i see in the server.log file lot of Select queries on many of the different tables are getting executed many times..
      One cause for this is there are CMR ( container managed relationships) fields between these tables..
      Due to this relationships all the related entities are getting loaded...
      Is there any way that we can tune the Jboss or configure in the jbosscmp-jdbc.xml file to delay the other entities loading...
      If you find any solution.. please let me know..

      regards,
      Ravi

        • 1. Re: Ways to tune Jboss CMP

          Hi Ravi,

          one possibility of tuning CMP permormance is the definition of load groups read-ahead strategies. Example from the docs (it's from jboss 3.2 so I don't know if it is exactly the same in jboss 4)

          Define load group for the entity bean:

          <load-groups>
          <load-group>
          <load-group-name>basic</load-group-name>
          <field-name>name</field-name>
          <field-name>nickName</field-name>
          <field-name>badness</field-name>
          </load-group>
          </load-groups>
          


          Specify read-ahead strategy for the query

          <query>
          ...
          <read-ahead>
          <strategy>on-find</strategy>
          <page-size>4</page-size>
          <eager-load-group>basic</eager-load-group>
          </read-ahead>
          </query>
          


          Take a look at the docs on how to do this with jboss 4.

          Regards,
          Stefan

          • 2. Re: Ways to tune Jboss CMP
            raviupasi

            Hi Stefan,
            thanks for your response .
            I had tried with Read-ahead but did not give any change and later tired with lazy-loadgroup....
            I was able to reduce the total number of query which was reapeating more than 200 times to 50times by
            using the Loadgroup and lazy load group tag in jbosjdbc-cmp.xml file..
            for example:
            I have a entity bean called content:

            <ejb-name>Content</ejb-name>
            .....

            <load-group>
            ContentTable
            <load-group-name>ContentLG</load-group-name>
            <field-name>name</field-name>
            <field-name>referenceName</field-name>
            <field-name>categoryId</field-name>
            <field-name>contentTypeId</field-name>
            <field-name>resourceId</field-name>
            </load-group>
            </load-groups>
            <lazy-load-groups>
            <load-group-name>ContentLG</load-group-name>
            </lazy-load-groups>

            before this change the container was firing the selcet query as:
            SELECT NAME FROM CONTENT WHERE (CONTENT_ID=?)
            SELECT REFERENCE_NAME FROM CONTENT WHERE (CONTENT_ID=?)
            SELECT CONTENTTYPE_ID FROM CONTENT WHERE (CONTENT_ID=?)
            SELECT RESOURCE_ID FROM CONTENT WHERE (CONTENT_ID=?)
            total 200 times the query was fired....

            but now the query has become..
            SELECT NAME, REFERENCE_NAME, CONTENTTYPE_ID, RESOURCE_ID FROM CONTENT WHERE (CONTENT_ID=?)
            but just 50 times....

            Now I want to c if the container is trying to fire the query for the same CONTENT_ID or different..
            Is it possible to get for which value is it firing the query everytime.
            If its the same content ID is there a way I can reduce thenumber of queries still...
            Any thoughts plz..

            regards,
            Ravi

            • 3. Re: Ways to tune Jboss CMP

              Hi mate,
              U can put this on the query tag on jbosscmp-jdbc.xml file,
              <read-ahead>
              on-find
              <page-size>200</page-size>
              <eager-load-group>basic</eager-load-group>
              <left-join cmr-field="expendeduria" eager-load-group="basic"/>
              </read-ahead>

              as well...

              I've read but i doesn't work with 323. Even what you have tried it doesn't work with my mysql....

              • 4. Re: Ways to tune Jboss CMP
                lafr

                What's the transaction attribute for the entity bean and the session bean accessing this entity bean?
                Reading one field after the other may have to do with it.
                We use REQUIRED per default for all and REQUIRES NEW for some special cases.