-->
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.  [ 2 posts ] 
Author Message
 Post subject: EntityManager.find(...) performance
PostPosted: Mon Jan 15, 2007 5:10 am 
Newbie

Joined: Mon Jan 15, 2007 4:06 am
Posts: 1
hi, ive been working on a ejb3 application that need to cache as much as possible. queries are cached manually by storing the result (only the primary keys) in jbosscache (the same cache as the entity beans).
when that query is called again we fetch the id's from cache and for each id we just call EntityManager.find(Class, id). most of the objects are loaded into the cache at this point, so there are zero db calls. this works very well, but it doesnt perform as good as we hoped.
a resultset of 1000 objects take 200ms when we call EntityManager.find(...) for each id, but if we call the cache directly for each entry it takes about 20ms in total (but we really do not want to do this).
and if we do the query "normally" (without any caching) it performs better than if we call EntityManager.find(...) for each entry, about 50-80ms.
are there any way to speed up the EntityManager.find(..) call?
IsolationLevel is none and CacheMode is local.

i understand that the easy solution is to not cache queries, but if we dont the database will crumble down in notime and i would rather not use the hibernate query cache since that would eat up cachememory very fast (since we also have entity cache).

i posted this in the JBoss EJB3 forums earlier without any responses so im trying my luck here. any input would be highly appreciated..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 21, 2007 7:16 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't know exactly what is taking time. Are you using a clustered cache?
I guess you should use a profiler to dig the issue.

_________________
Emmanuel


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