tags:

views:

49

answers:

2

Hi I have a web application with nhibernate talking to the database.

The application is running very slow due to lot of chatty db calls that nhibernate is doing. I want to run a profiler or something similar that can give some stats example

  1. number of db trips.
  2. table names and times accessed.

I saw one of the products called nhprof . I am wondering if there is something open source or free available out there or some other technique that i can use to meet the goal here.

Edit: I am using SQL Server 2005 .

+1  A: 

If you just want to know the 2 things you mention, you can create a log4net appender to find the information you want. I use a http module that adds the query information to the html in a web application when running in debug mode. If you want real statistics or more information than in the example, nhprof might be worth the money.

Paco
can you hint which appender to user to count the db connections and number of times a table is hit ?
dotnetcoder
Any appender can be used, its the actual logger that you need that I think you need.
Preet Sangha
NHibernate perf HttpModule sample: http://ayende.com/Blog/archive/2006/09/07/MeasuringNHibernatesQueriesPerPage.aspx
Mauricio Scheffer
NHibernate Statistics sample: http://nhforge.org/blogs/nhibernate/archive/2008/10/26/exploring-nhibernate-statistics-part-1-simple-data-fetching.aspx
Mauricio Scheffer
+1  A: 

The NHibernate statistics are available as ISessionFactory.Statistics and ISession.Statistics. For the basic stats you describe, this

That said, NHProf does more and is well worth the price.

Lachlan Roche