Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] SoftCacheWeakIdentityMap sizing recommendation by the EclipseLink wiki documentation

I don't think sizing the cache is any exact science.  If you want to be
aggressively caching, then make it as big as your memory can fit.  I have
used cache sizes of 100,000 before, and it seems to scale fine.  It also
depends on how big your data set is, if your table only has 1,000 rows, then
making the cache 1,000 would be fine.  It also depends on what your
tolerance to stale data is, as the bigger the cache is the longer something
will be in the cache.

I would say starting with a cache size of 1,000 is probably a good idea,
then go from there.  The QueryMonitor is a useful low level tool for
determining how many cache hits you are getting.



Gschwind, Doug wrote:
> 
> 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_Id
> entity_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
> 
> 
> 
> 
> 
> 
> 
> The contents of this electronic mail message and any attachments are
> confidential, possibly privileged and intended
> for the addressee(s) only. Only the addressee(s) may read, disseminate,
> retain or otherwise use this message. If
> received in error, please immediately inform the sender and then delete
> this message without disclosing its contents
> to anyone.
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/SoftCacheWeakIdentityMap-sizing-recommendation-by-the-EclipseLink-wiki-documentation-tp21590392p21605936.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top