tags:

views:

200

answers:

3

This is in reference to a question I asked earlier. Aside from viewing the SQL generated by NHibernate on calls to the database, what is the best way to find bottlenecks between NHibernate and the DB? In particular, I have queries that return very quickly when run directly against the database, but very slow (over 3-4x) return times when running the code in unit tests and on the web page. I am relatively sure this has something to do with the way I have mapped my tables and the primary keys. How can I dig in further to see where my slow areas are occurring? Are there other tools available? I know this is an extremely broad question, but I have not had the need to explore these problems yet. Any help would be greatly appreciated.

A: 

I use JProbe for analyzing my code. It can show the amount of time spent in any particular location in my code, and where the bottlenecks are. I'm sure there are other tools available though, some of which may be cheaper.

Elie
JProbe is for Java, his question is about .net
Mauricio Scheffer
Good point, kept reading that as Hibernate and dropping the N. However, I'm sure there's a tool similar to JProbe for .NET, and if there isn't, there's probably some decent money to be made in developing one.
Elie
+1  A: 

AFAIK there is no single tool to profile NHibernate, yet. This is about to change with Ayende's NHIbernate Profiler. In the meantime, you can use a combination of code profilers (e.g. dotTrace), SQL Server Profiler, the NHibernate logger, and static analysis, i.e. if you know about the SELECT N+1 problem, most of the time you can spot it just by looking at the code.

EDIT: NHProf is now available!

Mauricio Scheffer
A: 

for now use Sql profiler. Later on you can BUY Ayende's Nhibernate Profiler. Also you can log the sql and check.

Sheraz