-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to divide cache
PostPosted: Wed Mar 29, 2006 8:47 am 
Beginner
Beginner

Joined: Fri Mar 17, 2006 7:30 pm
Posts: 32
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1

I am using ehCache to do the second level caching for H3. Should I divide the cache into functional regions (for example, user registration objects are in one cache, sample requests in another and sweepstakes entries in a third) or should they be divided by time (short duration, long duration) or by something else? What is the best practice for caching under H3?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 6:54 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You shouldn't have to do anything like this, unless you're very very performance-concious. Or maybe if you're planning on using items in the cache independently of hibernate. Have you read section 19 of the ref docs? Sections 19.2 and 19.3 are mostly likely to be of interest to you.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 12:51 am 
Beginner
Beginner

Joined: Fri Mar 17, 2006 7:30 pm
Posts: 32
tenwit wrote:
You shouldn't have to do anything like this, unless you're very very performance-concious. Or maybe if you're planning on using items in the cache independently of hibernate. Have you read section 19 of the ref docs? Sections 19.2 and 19.3 are mostly likely to be of interest to you.


Actually I have read these parts. When I first setup H3 and started getting items from the database, it promptly blew up. This lead me to download ehCache and start cache regions.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 1:04 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Fair enough.

I've never seen a best practice being metioned anywhere around here, but I would imagine that it depends on how you're using the cache. If you're intending to do some cache management (specifically, you want to be able to evict chunks of cache based on age), then you'll probably want to follow java's model: eden, survivor1, survivor2, old. If you don't want that functionality, then you're probably using the cache to assist with LRU or MRU algorithms, so division by logical grouping would be best. If you're not "manually" using the cache at all, and are only setting it up to allow hibernate to make use of it, then you shouldn't have to worry about dividing it up.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 9:02 am 
Beginner
Beginner

Joined: Fri Mar 17, 2006 7:30 pm
Posts: 32
tenwit wrote:
Fair enough.

I've never seen a best practice being metioned anywhere around here, but I would imagine that it depends on how you're using the cache. If you're intending to do some cache management (specifically, you want to be able to evict chunks of cache based on age), then you'll probably want to follow java's model: eden, survivor1, survivor2, old. If you don't want that functionality, then you're probably using the cache to assist with LRU or MRU algorithms, so division by logical grouping would be best. If you're not "manually" using the cache at all, and are only setting it up to allow hibernate to make use of it, then you shouldn't have to worry about dividing it up.


Well, that does give me some ideas. I very rarely will need to deal with the cache manually and need it mostly for writing. For regular traffic areas, I will use a default cache, unless I start getting errors. For the higher traffic input areas (promotions and the like), I will use a named cache for each, size based on the size of the objects and the expected traffic. Since the higher areas are usually input only, the time to live for these objects will be small (a minute or less).

Who knows, perhaps this discussion will be the start of caching best practices.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.