-->
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.  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Performance Issue
PostPosted: Mon Mar 14, 2005 3:22 am 
Newbie

Joined: Fri Feb 11, 2005 7:20 am
Posts: 18
i am using hibernate3.0 but the performance of my application is very slow. i have enabled the ehcache. Please suggest how to improve the performance.

Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[/b]

Hibernate 3.0

[b]Mapping documents:[/b]


[b]Code between sessionFactory.openSession() and session.close():[/b]


[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:[/b]
Oracle


[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]

_________________
Thanks in advance,
Lakshmi


Top
 Profile  
 
 Post subject: Re: Performance Issue
PostPosted: Mon Mar 14, 2005 5:13 am 
Beginner
Beginner

Joined: Mon Dec 15, 2003 5:25 am
Posts: 48
Location: Delhi, India
Lakshmi wrote:
i am using hibernate3.0 but the performance of my application is very slow. i have enabled the ehcache. Please suggest how to improve the performance.


Can you provide supporting info about your claim?

_________________
Vinod K. Singh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 14, 2005 5:58 am 
Newbie

Joined: Fri Feb 11, 2005 7:20 am
Posts: 18
Hi ,

Could you please, tell me how to use ehcache(or any other cache) in hibernate. what are the properties to be set in the properties file etc.
now i have enabled

"hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider"

i added "<cache usage="read-write" />" in my mapping file.

and in the ehcache.xml i've added

<cache name="com.somecompany.someproject.domain.Country"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="true"
/>

where "com.somecompany.someproject.domain.Country" is my class name.

do i need to add anything else ?

my application is doing a lot of query to the database(oracle9i) and the system performance is too low.

and for this i am getting the following error in the mapping ".hbm.xml" file

Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

_________________
Thanks in advance,
Lakshmi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 14, 2005 6:17 am 
Beginner
Beginner

Joined: Mon Dec 15, 2003 5:25 am
Posts: 48
Location: Delhi, India
just look into the docs you will find the answer.

_________________
Vinod K. Singh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 14, 2005 6:35 am 
Newbie

Joined: Fri Feb 11, 2005 7:20 am
Posts: 18
Thanks.But can you tell me where can i find the that. Whatever i posted i got from the doc. since didnt work i asked for help.
One more thing if a person who is totally new to something is asking for a help this is not the way to answer. i am asking because i could not find the answer. the problem may be that i am not using the session properly, did not configure the properties file properly or something else. By putting a qn. i am not tying to question the product, but trying to learn it.

Thank you.

_________________
Thanks in advance,
Lakshmi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 14, 2005 11:38 am 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
You can also look in the source, specifically the test cases are a great resource!

_________________
Matt Veitas


Top
 Profile  
 
 Post subject: Performance Issue
PostPosted: Fri Mar 18, 2005 4:43 pm 
Newbie

Joined: Mon Mar 01, 2004 3:41 pm
Posts: 9
Hi,

There seems to be a real problem with performance. I was near the end of migration from Hibernate 2 to Hibernate 3, and now it seems the performance issue is intolerable.

Here're some test results with getting the session (fine), make a native SQL query, loading an object and doing a simple query with HQL respectively, all again PostgreSQL:

Using Hibernate 2:
The total time used to get the session (old): 47
total sql query time (old): 2953
total load time (old): 3407
The total query time (old): 3328

Using Hibernate 3:
The total time used to get the session (new): 47
total sql query time (new): 42624
total load time (new): 35045
The total query time (new): 44421

Hibernate 3 uses fewer queries against the database. However, it's drastically slower, which is not easy to understand.

Has anyone found an answer, or is there any special configuration to be done to speed up Hibernate 3, at least matching Hibernate 2?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 5:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you dont show any concrete ...

have you follow the migration guide to ensure you understand what has changed ?
have you looked at the log output and chekked what it do ?
etc.
etc.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 7:32 pm 
Newbie

Joined: Mon Mar 01, 2004 3:41 pm
Posts: 9
Hi Max,

You're right, i didn't follow everything in the migration guide. Though i did a lot of corresponding changes, i didn't change the DTD delarations, so it was using the DTDs in Hibernate 2. Also the classes generated from the mapping files were all made by Hibernate 2 tools. Amazing it still worked!

Now i changed the DTD declarations and the performance is much better (close to the Hibernate 2 settings). This is before regenerating the classes. Now i still need to figure out about the new CodeGenerator and the mapping details. It's not generating the property for the ID column in Java. The mapping against PostgreSQL for the ID column is, for instance:

<id name="no" type="integer" unsaved-value="null">
<column name="no" sql-type="integer DEFAULT nextval('seq_member'::text)" />
<generator class="sequence">
<param name="sequence">seq_member</param>
</generator>
</id>


The "no" didn't come up in the Java class. It worked with Hibernate 2 tools.

It seems there's still a long way to go in migration. Any idea would be appreciated.

Thanks!


Top
 Profile  
 
 Post subject: More slowness
PostPosted: Wed Apr 06, 2005 1:59 pm 
Newbie

Joined: Wed Jun 23, 2004 4:35 pm
Posts: 13
I am also experiencing extreme slowness on a particular query that used to be trivial. I'm using sybase.

here is the code;

[code] Session session = sessionFactory.openSession();
//A
List determinants = session.createCriteria(SearchObj.class).list();
//B
[/code]
logging statements at 'A' and 'B' indicate that the query takes about 11 minutes to return 32,000 rows.

When I migrated to 3, I modified the xdoclet hibernate task to use Hibernate 3 DTD. I'm not certain that this was a good idea but it seems to work otherwise;

Here is my mapping file;

[code]<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="org.myco.hibernate.beans.common.SearchObj"
table="t__srch_obj"
schema="mdp_cmn_prd.dbo"
>

<composite-id
name="key"
class="org.nmdp.hibernate.beans.common.SearchKey"
>
<key-property
name="locus"
type="org.nmdp.hibernate.type.TrimmedStringType"
column="ag_locus"
/>

<key-property
name="yype"
type="org.nmdp.hibernate.type.TrimmedStringType"
column="type_val"
/>

</composite-id>

<property
name="searchObj"
type="org.nmdp.hibernate.type.TrimmedStringType"
update="true"
insert="true"
column="srch_obj"
/>

<property
name="codeIndicator"
type="java.lang.String"
update="true"
insert="true"
column="cde_ind"
/>

<property
name="activeIndicator"
type="java.lang.String"
update="true"
insert="true"
column="active_ind"
/>

<property
name="lastUpdateId"
type="org.nmdp.hibernate.type.TrimmedStringType"
update="false"
insert="false"
column="lst_updt_dte"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-DnaSearchDeterminant.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>[/code]

The resulting query is;

[code]select this_.ag_locus as ag1_0_, this_.typ_val as typ2_0_, this_.srch_obj as srch3_30_0_, this_.cde_ind as cde4_30_0_, this_.active_ind as active5_30_0_, this_.lst_updt_dte as lst6_30_0_ from mdp_cmn_prd.dbo.t_srch_obj this_[/code]

Any suggestions?[code][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 2:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that mapping and query shouldnt be affected in any major way because of the migration....something else must be causing this...how fast where it before ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: previous perfprmance
PostPosted: Wed Apr 06, 2005 3:00 pm 
Newbie

Joined: Wed Jun 23, 2004 4:35 pm
Posts: 13
Previously it might take a minute if the server was occupied. Now it takes 11-14 minutes.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 4:49 pm 
Newbie

Joined: Wed Jun 23, 2004 4:35 pm
Posts: 13
Help me interpret this; I turned on the Statistics package in hibernate and reloaded the app to the appserver;

2005-04-06T15:42:57.125-0500|entities loaded: 31900
2005-04-06T15:42:57.125-0500|entities updated: 0
2005-04-06T15:42:57.125-0500|entities inserted: 0
2005-04-06T15:42:57.125-0500|entities deleted: 0
2005-04-06T15:42:57.140-0500|entities fetched (minimize this): 0
2005-04-06T15:42:57.140-0500|collections loaded: 0
2005-04-06T15:42:57.140-0500|collections updated: 0
2005-04-06T15:42:57.140-0500|collections removed: 0
2005-04-06T15:42:57.140-0500|collections recreated: 0
2005-04-06T15:42:57.140-0500|collections fetched (minimize this): 0
2005-04-06T15:42:57.140-0500|queries executed to database: 0
2005-04-06T15:42:57.140-0500|query cache puts: 0
2005-04-06T15:42:57.140-0500|query cache hits: 0
2005-04-06T15:42:57.140-0500|query cache misses: 0
2005-04-06T15:42:57.140-0500|max query time: 0ms

If I understand this correctly - the entire query was returned from the cache? In spite of the application being redeployed?

If that's true then the entire delay has something to do with my hibernate configuration.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 2:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
something else is causing this.

if the query is the same then nothing should be "heavier".

The only thing that i know could have performance impacts (but which in this case actually should make it faster) is that assocations and classes now are default to lazy="true".

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 2:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no there are all zero's in the statistics - and it says 31900 entities were loaded...from the db

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next

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.