Frank Morton wrote:

>>What is Profile? An EJBObject? Where did the profile object come from?
>>
> 
> Profile is an EJBObject. It was instantiated in the first place with
> the findAll() finder method. I stuff the resulting Collection in
> the session (is this the best way to do it?) which is then retrieved
> from the session by the jsp. It is on the jsp that accessing the
> fields is incredibly slow.
> 


It sure is! What's happening is that when you call 'getID' JBoss has a 

lot of work to do in order to be spec compliant (not neccesarily in order - 

check your standardjboss.xml for interceptor stack order):

1. start a transaction.
2. locate the EJB object in cache (should be, unless you specify commit 
option C)
3. aquire the bean's lock & associate with this transaction.
4. does the bean have its state? If not load it from the database. (Note
that this _always_ happens for commit options B and C!)
5. invoke the method (finally!)
7. release the lock.
8. store any entity beans that have been associated with the 
transaction, unless they claim (via isModified) that they haven't changed.
8. dissacociate the bean from the transaction. If commit option is B 
mark the bean as needing a state refresh. If commit option is C, remove 
the bean from the cache.

So that's why it takes a while. If you're using commit option A, a 
second run of the JSP should be a bit faster.

Things you can do to make it faster:
1. Wrap that up in a session bean method that returns a bunch of summary 
objects. This aggregates the transaction.
2. Implement 'boolean isModified()' methods on your entity beans to 
return false if the beans haven't changed.
3. For CMP, turn on readahead (see docs online). This will really only 
help in conjunction with 1.

4. Use commit option A, if possible. The first run will still be slow 

(unless you use read-ahead and the session wrapper), but subsequent runs

should be much faster. Why wouldn't you use option A? if anything else 
can change your database, you can't because changes won't be picked up. 
Note that there's a commit option D that (if memory serves) was added to
support relatively static entities that get changed only occasionally 
from the outside world.

If you do combine tips 1 and 3 and don't see a big performance 
improvement, let me know right away.

hope this has helped,
danch




_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to