-->
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.  [ 3 posts ] 
Author Message
 Post subject: Memory profiling Hibernate-based applications...
PostPosted: Fri Sep 05, 2003 12:42 pm 
Newbie

Joined: Thu Sep 04, 2003 10:37 am
Posts: 1
I am profiling an application built on top of Hibernate. The profile tool is OptimizeIt.

The application appears to create a lot of classes of the form:

com.acme.model.company.Company$$ProxiedByCGLIB$$64
com.acme.model.company.Company$$ProxiedByCGLIB$$65
com.acme.model.company.Company$$ProxiedByCGLIB$$72

...and there is only ever one instance of each of these classes.

Under heavy load, the VM created more than a thousand such class definitions in a 24 hour period. I presume this behavior is related to Hibernate 'wrapping' domain classes to give them persistent behavior.

I can understand that if I have 24 (persistent) domain classes in my application, that there should be 24 Hibernate 'wrapper' counterparts. Why are there so many duplicate 'wrapper' classes for each domain class; and only ever one instance of those wrappers? This behavior seems really inefficient.

Any advice?

Thanks in advance,

Dayle


dayle.woolston@nextpage.com


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 05, 2003 2:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
I presume this behavior is related to Hibernate 'wrapping' domain classes to give them persistent behavior

This is incorrect. Hibernate can persist your objects without any wrappers (well, except for collections). It actually relates to you defining proxies in your mapping. CGLIB is the library Hibernate uses to generate dynamic proxies in order to implement lazy loading.

You could turn off proxying if you really want to, but just wait till you see the amount of garbage created by your jdbc driver.


Top
 Profile  
 
 Post subject: Re: Memory profiling Hibernate-based applications...
PostPosted: Sun Sep 07, 2003 2:04 am 
Beginner
Beginner

Joined: Fri Aug 29, 2003 3:39 pm
Posts: 33
Location: San Francisco, CA
dayle wrote:
I can understand that if I have 24 (persistent) domain classes in my application, that there should be 24 Hibernate 'wrapper' counterparts. Why are there so many duplicate 'wrapper' classes for each domain class; and only ever one instance of those wrappers? This behavior seems really inefficient.

Those particular classes are method proxies, and there will be one created for each method of every class that is proxied. There is some overhead to create these but it will only happen the first time the class is used, and they speed up the actual execution of the proxies quite a bit (by eliminating reflection).

That said, for CGLIB 2.0 we are adding some new code which will both increase the performance of the proxies even further while also seriously reducing the number of generated classes.

Chris


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