-
1. Re: Better performance?
schmidts Nov 24, 2004 3:57 PM (in response to smileyq)I really appreciate all of the responses I have received so far. I am still working on fine tuning perfomance of this application using the jboss loading methods. One problem that I see if that my tables are way too normalized and this cases performance problems while using entity beans. I am still trying to grasp jboss optimization of entity beans using the on-find and on-load features. Agan I appreciate the great responses I have recieved so far.
Thanks. -
2. Re: Better performance?
jobor Nov 25, 2004 2:56 AM (in response to smileyq)I have thought about the same thing. Why should I not use a normal finder for getting the childs. But most likely your FK field is not available as a CMP field which can be used in EJB-QL.
If you need the bean and the childs in 1 transaction you can consider the use of left-join read-ahead. This will read in the SQL resultset (2 joined tables) in the read-ahead cache and wnen you call a method on the child bean the data is loaded from the read-ahead cache.
If you need the childs at a later time you can call the normal CMR field. But you can optimize also that one with a read-ahead element in the ejb-relation element. This wil select the fields of the eager load group in SQL statement. The page size is used for finding fields that are not loaded in the first SQL statement. But if all your fields are in the eager load group than just 1 SQL statement is executed to populate your child collection.<ejb-relation> <ejb-relation-name>T1-Tm</ejb-relation-name> <foreign-key-mapping/> <ejb-relationship-role> <ejb-relationship-role-name>t1-has-tm</ejb-relationship-role-name> <key-fields> <key-field> <field-name>key</field-name> <column-name>tm_fk</column-name> </key-field> </key-fields> <read-ahead> <strategy>on-find</strategy> <page-size>8</page-size> <eager-load-group>all</eager-load-group> </read-ahead> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name>tm-belongs-to-t1</ejb-relationship-role-name> <key-fields/> </ejb-relationship-role> </ejb-relation>
Johan -
3. Re: Better performance?
aloubyansky Nov 26, 2004 2:35 AM (in response to smileyq)You can also map foreign key fields to the columns CMP fields are mapped to. So you could add a CMP column that represents a foreign key and use it in queries.
-
4. Re: Better performance?
smileyq Nov 26, 2004 1:53 PM (in response to smileyq)I really appreciate all of the responses I have received so far. I am still working on fine tuning perfomance of this application using the jboss loading methods. One problem that I see if that my tables are way too normalized and this cases performance problems while using entity beans. I am still trying to grasp jboss optimization of entity beans using the on-find and on-load features. Agan I appreciate the great responses I have recieved so far.
Thanks. -
5. Re: Better performance?
smileyq Nov 30, 2004 10:41 AM (in response to smileyq)After working with the optimization of my entity beans I have taken the page load down from 5 seconds to 1 or less by switching to using CMR methods of my entity beans instead of using the finder methods of the target side of the relationship. I setup read ahead with on-find and noticed a huge difference in performance. Another thing I made sure of was that my methods were wrapped within transactions to call fewer SQL statements. This just proves that you must plan out your entity beans and implement them properly or you will suffer from some severe performance problems which I'm sure have turned many people away. Best of luck to you all.