-->
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.  [ 7 posts ] 
Author Message
 Post subject: Hibernate 2.1.1, performance, memory usage, Session cache
PostPosted: Mon Oct 04, 2004 2:37 pm 
Beginner
Beginner

Joined: Wed Dec 03, 2003 10:59 am
Posts: 47
Hibernate version: 2.1.1

Name and version of the database you are using: PostgreSQL 7.3.4

Hello,

I have a command-line app that uses Hibernate to fetch data from DB.
I have 2 issues with this app:

1. It uses a lot of memory
2. It runs very swiftly at first, but starts slowing down as time passes

Issue 2 may be the artifact of 1 (high memory use -> more GCing, more swapping...)

So I used JProbe to profile my app. What I found was that of all the classes in my application and Hibernate, Query.list(), Session.find(String) and various versions of *BulkBeanByCGLIB*... methods are the ones that take the most time. That may be understandable, since I do pull a lof of data from DB.

It also seems that objects that consume the most memory are under Hibernate (I could not quite see this with my evaluation version of JProbe, but everything I see points in that direction). I suspect it is the Session object that's caching everything that I'm loading from DB. I tried calling clear() on my Session instance to reduce the memory usage, but that didn't have any effect.

Can anyone recommend some strategies for reducing the memory footprint?

Thanks,
Otis


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 2:44 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
http://blog.hibernate.org/cgi-bin/blosx ... batch.html
may help

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:11 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
There is a way to dissable "BulkBean" stuff, It generates byte code to copy bean properties to array and from array to bean, probably it is meaningless on "new" JVM's (It was designed to to optimize native method invokation, but it generates "copier" class per persistent class on startup). "BulkBean" must be faster than reflection (memory used by this stuff is constant, it must not depend on data), but find cglib related system property to dissable this stuff and test it, it must be documented.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:11 pm 
Beginner
Beginner

Joined: Wed Dec 03, 2003 10:59 am
Posts: 47
Thanks. I saw that blog entry, but I think my situation is different. I don't need to update nor save any objects - I'm only reading them from DB. So there is no need to call session's flush(), I think, and calling its clear() doesn't seen to have any effect on the memory use.

Is there anything I can do?

Thanks,
Otis


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:25 pm 
Beginner
Beginner

Joined: Wed Dec 03, 2003 10:59 am
Posts: 47
baliukas wrote:
There is a way to dissable "BulkBean" stuff, It generates byte code to copy bean properties to array and from array to bean, probably it is meaningless on "new" JVM's (It was designed to to optimize native method invokation, but it generates "copier" class per persistent class on startup). "BulkBean" must be faster than reflection (memory used by this stuff is constant, it must not depend on data), but find cglib related system property to dissable this stuff and test it, it must be documented.


Hm, I'm looking and looking, and can't find any references to the system property for disabling this (no mention on cglib.sf.net, Google's not helping). Would you happen to know the property name?

Thanks,
Otis


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:34 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
You need to tune "FetchSize" for PostgreSQL driver too, it loads data to client memory without cursor by default (but your mapped objects will eat memory any way if you copy stuff to some collection).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:37 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
http://forum.hibernate.org/viewtopic.ph ... +optimizer


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