-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Caching object w/ collections
PostPosted: Thu Jul 29, 2004 12:42 pm 
Newbie

Joined: Wed May 12, 2004 10:24 am
Posts: 11
Is there any way to have Hibernate cache an entire object, complete with its collections, in a single cache? Rather than having a cache for the base object, association, child object, etc. We use a distributed replicated cache and having child objects potentially partitioned across 6 servers may be a huge performance hit. Would like to retrieve the entire object graph from one cache.

Thanks in advance for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 2:26 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
We use a distributed replicated cache and having child objects potentially partitioned across 6 servers may be a huge performance hit. Would like to retrieve the entire object graph from one cache.


This is not how a distributed replicated cache works.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 3:39 pm 
Newbie

Joined: Wed May 12, 2004 10:24 am
Posts: 11
My mistake, I meant to say we use a distributed cache. In this case the data IS partitioned across multiple machines.

Regardless, is there any way to cache only "composed" objects through the Hibernate API? On the surface there does not appear to.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 3:41 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hm, it is not possible and I still don't see why you would need this.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 4:25 pm 
Newbie

Joined: Wed May 12, 2004 10:24 am
Posts: 11
For an example we might have a listing, with say 20 items, each item with 5 attributes. In the distributed cache each object potentially (in the average case) incurs a slight network overhead. So if I could store the entire object in one cache, I would never incur more than one network hop. Now, the way I am using Hibernate now, I would incur 1 (listing) + 20 (collection association) + 20 (items) + 100 (collection association) + 100 (attributes) = 241 network hops. Suddenly even a slight network latency is magnified!

Obviously for some types of objects I can lazy load them and greatly reduce the overhead. However some will HAVE to utilitze their entire collection. Those I would like to store as one blob of an object rather than their constituent parts.

Worst case scenario I have to manually cache these types of objects. However the Hibernate API is simple and flexible and I would like to use it across our whole domain model.

Thanks for your help in any case.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 4:33 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A distributed cache doesn't have to do distributed lookups, just distributed invalidation or replication.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 4:43 pm 
Newbie

Joined: Wed May 12, 2004 10:24 am
Posts: 11
christian wrote:
A distributed cache doesn't have to do distributed lookups, just distributed invalidation or replication.


A replicated cache (ie complete data set on each cluster member) does not have a lookup penalty. A distributed (ie data set partitioned across n servers) will have to go across the network in many cases to retrieve the date. Our data set is much too large to be completely contained on a single cluster member.

Irregardless it sounds like there is no way to configure Hibernate for the type of caching I'm looking for.[/i]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 5:20 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I think that this is outside of the scope of Hibernate: Hibernate will use a cache region for each class and each collection that should be cached. How the cache provider distributes the cache regions is implementation- or configuration-specific. I still think that this kind of cache architecture is questionable: I'd rather recommend setting appropriate limits on the cache size on each node rather than distributing data. The lookup is probably more expensive in any case than a database hit, at least for transactional data.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.