geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianny Damour <gianny.dam...@optusnet.com.au>
Subject Pre-fetching Feature - Now available
Date Sun, 03 Jul 2005 11:41:33 GMT
All,

I would like to announce the availability of some CMP tuning features, 
which allow for the pre-fetching of a group of CMPs when:
* a CMP method (CMP and CMR getters or setters included) is executed and 
the CMP is not already in the transactional cache;
* a CMP field is accessed and its value is not already in the 
transactional cache;
* a CMR field is accessed and its value is not already in the 
transactional cache;
* a finder is executed; or
* a select returning an EntityBean is executed.

Let me try to describe the current implementation.

For each CMP, a set of pre-fetching groups can be defined. These groups 
can be mapped to the defining CMP, its CMP fields, CMR fields, finders 
or selects methods. These mappings identify a group of CMPs to be 
pre-fetched upon transactional cache miss or execution of finders or 
selects. There are two types of transactional cache misses:
* the CMP being invoked is not in the transactional cache; and
* a CMP or CMR field being accessed is not in the transactional cache. 
Note that in this specific case, the CMP is in the transactional cache, 
yet the accessed field is not loaded.
For the first type of transactional cache miss, the implementation 
fetches the primary key fields along with the pre-fetching group mapped 
to the CMP. For the second type, the implementation fetches the field 
value along with the pre-fetching group mapped to the CMP or CMR field.

There are a couple of integration tests using the "standard" order, 
billing address, shipping address, line item and product CMP model there 
(OpenEJB itests module):
* PrefetchFacadeBean.testFinderPrefetch: pre-fetching upon execution of 
a finder. When OrderLocalHome.findPrefetchAll is executed, billing 
address, shipping address, line items and products are fetched at the 
same time. The underlying SQL query looks like this:
SELECT o.id, o.reference, // order CMP fields
               T0.id, T0.street, T0.city, // shipping address CMP fields
               T1.id, T1.street, T1.city, // billing addres CMP fields
               T2.id, T2.quantity, // line item CMP fields
               T3.id, T3.name, T3.product_type // product CMP fields
   FROM order_table o
                LEFT JOIN address T0 ON (T0.id = o.fk_shipping_address)
                LEFT JOIN address T1 ON (T1.id = o.fk_billing_address)
                LEFT JOIN line_item T2 ON (o.id = T2.fk_order)
                LEFT JOIN product T3 ON (T3.id = T2.fk_product)
 WHERE (o.id = ?)
* PrefetchFacadeBean.testEJBPrefetch: pre-fething upon CMP transactional 
cache miss: When LineItemLocalHome.getQuantity() is executed, the 
related product is fetched at the same time; and
* PrefetchFacadeBean.testCMPPrefetch and 
PrefetchFacadeBean.testCMRPrefetch: pre-fetching upon CMP or CMR field 
transactional cache miss. When order.getReference() and 
order.getBillingAddress() are respectively executed, billing address, 
shipping address, line items and products are fetched at the same time.

I am still working on some related tunings; yet, I think that the 
pre-fetching feature is now available.

Thanks,
Gianny

Mime
View raw message