Hello everyone,
I am trying to determine how to size our
SoftCacheWeakIdentityMap per JPA mapped class. In reading the documentation on
this subject (http://wiki.eclipse.org/Introduction_to_Cache_(ELUG)#Soft_Cache_Weak_Identity_Map_and_Hard_Cache_Weak_Identity_Map),
it states “set this cache size to be as large as the maximum number of
objects (of the same type) referenced within a transaction”. This seems
like it could be an inappropriately low number for a web application where many
users could be modifying different aggregate roots at all times of day.
Suppose we have a simple system of online ordering, and a
simple JPA mapped domain model where Order instances are aggregate roots and
Order has a one to many JPA mapped relationship to OrderLineItem (and of course
the back pointing ManyToOne). If we expect a large number orders to be viewed, modified,
or created per day, and we also in general expect the largest Order to have
only 10 OrderLineItem instances, according to the statement above, we should
set the SoftCacheWeakIdentityMap size to 10 for the OrderLineItem class. Lets
say with this kind of Order volume, at peak periods some 100 Order instances
are concurrently being viewed or modified. Would the recommendation in that
environment be to set the SoftCacheWeakIdentityMap size for the OrderLineItem
class to something more like 1000, assuming of course that you have adequate
heap space to keep 1000+ OrderLineItem instances on the heap at any point in
time?
I also saw the QueryMonitor and PerformanceProfiler, both in
the org.eclipse.persistence.tools.profiler package mentioned to help understand
the shared cache hit and miss information as noted here : http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg01744.html.
Is either of those tools the best known approach for determining how good your
identity map sizing choices are working?
Thanks,
Doug Gschwind