-->
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: CGLIB Performance
PostPosted: Thu May 26, 2005 5:56 pm 
Newbie

Joined: Thu May 26, 2005 5:32 pm
Posts: 2
[b]Hibernate version: 2.1.6[/b]

Hello,

I've been using hibernate for abour 2 year of so, without many problems. The project I am on now requires us to retrieve up up to 15000 object per query. The app centers around querying this data, so we may need to raise the limt to 10s of thousands.

Anyway, it was taking at least 10-20 seconds per query of 7500. Long story short, I solved to problem by busting into the code to where the objects are created. If I am loading this master data class, I would short cut to a class i wrote to read from the result set and set the properties of my new class directly, avoiding the reflection.

With this modification I can load 80k object in about 20 seconds, or so the typical query of 10,000 or so is a manageable couple sec.

So I feel fairly confident that the CGLib reflection is where the time was spent.

Is there a good way to do this?

While I'm happy it works, and I encapsulated the code as much as possible, it still sucks, and is fairly brittle. If I upgrade to hib3 I have to redo. I can live with updating my "Custom Hydrator" since it is only for one of the classes.

Thanks for you help,
Nick


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 3:31 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
NO, it is not a cglib problem, but you can dissable "reflection optimizer" using system properties to test it.
This optimizer is faster than standard reflection, but the weight in query processing will be very small, if it takes 20 sec:

jdk 1.4.2_5 on windows

100000 objects

Standard reflection
544 ms. 0.00544 per iteration

Cglib
78 ms. 7.8E-4 per iteration

You can find this test in cglib CVS ( "net.sf.cglib.beans.TestBulkBean" )


Probably problem is a memory allocation for data structures to store result.


Top
 Profile  
 
 Post subject: Allocating memory
PostPosted: Tue Jun 07, 2005 2:08 pm 
Newbie

Joined: Thu May 26, 2005 5:32 pm
Posts: 2
Thanks for the advice.

I'm sure this is a dumb question but,
I'm not sure how to increase my memory for the stored results. I've give the JVM a GB of memory to work with. Does hibernate or CGLIB some how constrain the amout of memory it works with?

Thank,
Nick


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 3:56 am 
Newbie

Joined: Thu Feb 03, 2005 5:49 am
Posts: 19
Hello nhruza1
I have the same problem. I'm executing a query which returns 17000 records and it takes about 30 seconds.
I would be very please if you could help me telling me in which part of the hibernate code I should make my modifications in order to make the Custom Hydrator

Thanks in advanced.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 4:10 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
try to run this code in profiler and post statistics, it is possible to make it as fast as custom hydrator, we just need to reproduce it in simple test.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 4:26 am 
Newbie

Joined: Thu Feb 03, 2005 5:49 am
Posts: 19
thank you for your help baliukas.
I'm sorry but I'm a new user with hibernate and I don't know how to do that (to run the code in profiler and post statictis)
what I have to do?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 4:40 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
http://eclipsecolorer.sourceforge.net/i ... filer.html

there is good profiler in netbeans too.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 4:48 am 
Newbie

Joined: Thu Feb 03, 2005 5:49 am
Posts: 19
That's good !

Thank you again.

I'm using eclipse so it's fit perfectly


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.