4 Replies Latest reply on Jul 26, 2002 10:59 AM by justin

    read-ahead & transaction performance tuning

    justin Newbie

      I'm having a problem convincing JBoss to optimize it's query usage when using the read-ahead and transaction options for performance tuning.

      Despite following the examples in the Quickstart guide and the latest JBossCMP docs regarding the transaction attributes and the read-ahead strategy, I'm continuing to generate N*M +1 queries when loading a group of entities using commit-option B.
      Each entity N is having M (M=number of fields in the bean) queries called on it, since JBoss is throwing away the entity data between abstract accessor calls.

      I set the transaction attributes of my session bean methods to RequiresNew. These session beans call the field accessors of the entity beans. Standard, basic design pattern here. So I don't understand why all of these queries are still being generated. The entity bean accessor calls should be inside a transaction, right?

      When I set the commit option to 'A', the queries are reduced to N+1 for the first session bean method invocation, then 1 query for subsequent invocations of the same method. This caching behavior is what I expect, although the initial N+1 is unexpected, since I have the read-ahead strategy set to 'onfind' with a page-size of 10:

      <declared-sql> ...</declared-sql>

      The 'basic' eager load group is being followed, as the query printed to the
      server.log shows only the fields mentioned in that load-group in the SELECT

      Any idea why JBoss seems to be ignoring the read-ahead strategy and/or the transaction setting of 'RequiresNew' but not the load group?

      I'm using Branch_3_0 from CVS, checked out a few days ago.

      Thanks in advance for any help with this.