-->
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.  [ 1 post ] 
Author Message
 Post subject: Any strategies for caching large collection on demand?
PostPosted: Tue May 16, 2006 4:19 am 
Newbie

Joined: Tue May 16, 2006 3:39 am
Posts: 1
Hibernate version: 3.1.x
Name and version of the database you are using:Oracle 9x

I have a large collection that I can't afford to load into memory. I would say around 100,000 objects in the collection and I have many(100s) of these collections. That collection needs to be pageable as well as sortable in many different ways. The objects gets deleted/updated quite often and new objects gets added to the collection often as well.

I have decided to run a query against the database on each http request.

So far I have optimized the query with all the possible sorting order with a corresponding db indexes and using setMaxResult and setFirstResult in my query interface in order to page it.

The query is relatively fast.

The problem now is that it is getting too expensive to query the large table with the volumn of http request. Ideally I would like to cache the data.

The first thing that comes to my mind is Query Cache, well, the default implementation is quite useless in my case as the collection gets updated/deleted/inserted quite often. I thought of writing my own Query Cache implementation by making it more stale tolerant(e.g, ignore updates, let the query cache timeout, inserts only expire certain query result). It seems like a good idea until I realize that the multiple sorting requirement will make the expiration of query cache quite difficult, since new objects might appear on pages in the middle of collection.

I would think that issues like this would appear quite often with such a large number of people using Hibernate. If you guys have encounter similar problem before I would love to hear what solution you have.

I want to thank those of you who spend the time to read my issue.


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

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.