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: nhibernate perfomrance problems
PostPosted: Wed Oct 15, 2008 8:18 pm 
Newbie

Joined: Mon Apr 14, 2008 10:22 am
Posts: 6
hi everbody,

i've got a problem with nhibernate in a really big web application. i'm working on this app since the last 6 month and right now i finished nearly 40% of what has to be there. till yesterday everything works fine in my eyes. i created a n-tier web app in a real flexible way to have answers to everything the customer will come up with.
so to start up at the bottom there is my mssql database with a lot of triggers and stored procedure to handle a history and backup strategie. next layer is hibernate with the dataclasses and the basic data access. on top i've got a controller layer with business logic and one class to handle the communication with the webservices and web views. i hope this is enough to get a short idea of what is happening.
what i found in the documentaion and on other post, i open and close the isession for each request. now i should come to my problem. right now i only created about 120 tables in database with nearly 50 dataclasses and this is not the end as i said only 40% of the final app. my mapping files have relations for nearly the whole database. so to say you start at one end and with the lazy mapping it is possible to navigate through all of the dataobject. first question: is this the right way to work with nhibernate relations? or did i misunderstood the idea of hibernate mapping?

but now my real problem. yesterday i imported some testdata because the time before i only handled a few entries in the database. but i realy have to handle a lot of data. so to say right now i got more than 20000 records in only one table and there are a lot of tables and this is only a test. so imagine there will be really a lot of data. now i wanted to start up the application and my browser was busy for nearly 5 minutes before the exception of script timeout occurs. so the way i build up my app will not work with this mass of data.

any ideas how to improve perfomance?
i thought about to clean up the mapping relations and load related collections on demand with hql. and also if i should open and close the isession in the business layer and init the needed objects before pass them to top.

so i will stop here and hope somebody will reply or send a link to usefull information. i really need some discussion how to go on with this.
thx even for reading this.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 17, 2008 2:22 pm 
Newbie

Joined: Mon May 05, 2008 10:34 am
Posts: 11
Location: Houston, TX
You ask a pretty open question so I will give a pretty open ended answer regarding NHibernate. From a design perspective I'd make sure we have surrogates designated for each table. It makes joins simpler and faster as well as making Equals & GetHashCode overrides easier and more robust.

Secondly I would start with everything set to lazy load.

Next I would look at implementing AJAX Grids, such as Teleriks, where when you retrieve parent to child information it can be done on the event of something. This means you will only retrieve back the data that's necessary.

I'd look as an efficient way of handling sessions, personally I use the Spring.Net framework and I think the way they have implemented it is very robust and flexible. Castle project also has a good implementation of this from what I have hard.

Next I would make sure that I am using the latest version of NHibernate (2.0).

Also use generic ILists and <Bags> for your one-to-many relationships as they are faster.

Finally use criteria expressions for your query over HQL.

Hope some of this helps.

Good luck!


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.