NH ProfNHibernate Profiler vs. Sql Profiler
I recently got a question, asking why someone should pay for NH Prof if SQL profiler is available for (effectively) free?
The answer is actually very easy to answer. I run the following scenario through both NH Prof and SQL Profiler:
using (var s = sf.OpenSession()) using (var tx = s.BeginTransaction()) { s.CreateCriteria<User>() .Add(Restrictions.NaturalId() .Set("Username", "Ayende")) .SetCacheable(true) .UniqueResult(); tx.Commit(); } using (var s = sf.OpenSession()) using (var tx = s.BeginTransaction()) { s.CreateCriteria<User>() .Add(Restrictions.NaturalId() .Set("Username", "Ayende")) .SetCacheable(true) .UniqueResult(); tx.Commit(); }
Here is what NH Prof gave me:
And here is what I got from SQL Profiler:
I think that I have rested my case, pretty conclusively.
More posts in "NH Prof" series:
- (09 Dec 2010) Alert on bad ‘like’ query
- (10 Dec 2009) Filter static files
- (16 Nov 2009) Exporting Reports
- (08 Oct 2009) NHibernate Search Integration
- (19 Aug 2009) Multiple Session Factory Support
- (07 Aug 2009) Diffing Sessions
- (06 Aug 2009) Capturing DDL
- (05 Aug 2009) Detect Cross Thread Session Usage
- (22 May 2009) Detecting 2nd cache collection loads
- (15 May 2009) Error Detection
- (12 May 2009) Queries by Url
- (04 Feb 2009) View Query Results
- (18 Jan 2009) Superfluous <many-to-one> update
- (18 Jan 2009) URL tracking
- (10 Jan 2009) Detecting distributed transactions (System.Transactions)
- (06 Jan 2009) The Query Cache
- (05 Jan 2009) Query Duration
- (24 Dec 2008) Unbounded result sets
- (24 Dec 2008) Row Counts
Comments
no to mention you need to get SQL Profiler for PostgreSQL (myfav), SQLite, MySQL...etc.
MS SQL Server isn't the only option for few of us, so another nHProfiler (multi-database support) win
I've just read this blog entry which mentions NHProf...
itcodemonkey.blogspot.com/.../...ting-list-of.html
Haven't tried NHProf yet, but MS SQL Profiler is truly an awful piece of software. Its definitely an absolute last resort for me to use it.
:)
Nice. I don't need persistence in my application, but I'm now starting to wonder if I should YAGNI it anyway. :)
Come on, you can select the events you need, select the columns you want to see etc.
But then without other kind of logging, I guess there are some informations that might miss.
We have been using NHProf for several weeks now... my statement about the tool would be if you are using NHibernate then NH Prof is a must have tool if you want to be productive. Troubleshooting and performance tuning are much easier.
*We paid beta pricing for our each team member and it has already paid for itself on a single project.
At first glance I would agree with ChrisB also, but I looked a little closer and realized the difference that wasn't really highlighted in the article. I believe the key point here is that while not only does NH Prof look visually more appealing (which is self apparent), but it can also highlight the caching aspects within NH that the traditional database profiler doesn't see and so cant report! So its not the visual/readability aspect, but it is more of the whole holistic system can be profiled rather than just the raw DB access. Plus as others above have pointed out it is DB agnostic.
Sql Profiler is completely worthless as a tool especially for non DBAs.
Uh, I use sql profiler.. it might not be that friendly looking or tell you a huge amount but it can be useful.
The point is: the second query is not seen by Sql Profiler.
Both are useful tools, but IMHO this is comaring apples and oranges. For example SQL Profiler can give things like read counts showing where you might investigate adding extra indexes, database issues. NH Prof is about watching the ORM. Checking how sql is constructed via the maps. Number of round trips. One click and you are back to visual studio looking at the calling code.
I must admit I was a little late to NHibernate land, only doing it for about a year, but I am sold. And NH Prof is a great teaching/learning tool for anybody just getting started.
If anyone is seriously questioning NH Profiler vs Sql Profiler, they've only ever used Sql Profiler. I can't imagine anyone who's used both asking that question :)
NH profiler gives you 2nd level cache notifications (very important for performance analysis), and allows you to go all the way up the stack with where certain queries are being executed at (also very important when you get into a command pattern structure). Plus intelligent suggestions to improve performance, along with high level reporting to help you find the pain points rapidly.
And if that wasn't enough, the UI trumps Sql Profiler's hands down. The difference between a good application and a great one is often in the UI design.
Comment preview