NH Prof: A guided tour

NH Prof has reached the level in which I can actually talk about the features that it has in more than abstract terms. There is still a big feature area that I want to cover (which should be a nice surprise), but the basics are there, and today I had ample proof that it is maturing just nicely. I was able to deal with quite a few of the remaining tasks by applying check listing. Basically, to do X, I had to do A,B & C. Trivially simple, and quite satisfying.

Test coverage went back up to over 90% on the backend again, which is also nice.

Anyway, let us start with the tour, shall we?

  image

The left upper pane shows the captured sessions. You can see the number of statements per each session, as well as the length time it was open.  Let us move down a bit, and explore statistics.

image 

The session factory statistics pane include a lot of information about NHibernate, which can give you a good indication about what is going on in the application in a global fashion. In 2.0 we have quite a few data points, but the statistics feature was significantly expanded in 2.1, and contains a lot more data and more finely grained statistics.

But that is probably not what gets you excited. What is likely to thrill you are the statement view.

image

I put a lot of though into designing those (well, into thinking about them, the actual design was handled by people who actually know what they are doing, design wise). The upper section of the screen is optimized to allow the human eye to quickly scan it in order to find all sorts of interesting patterns. Compare this to SQL Profiler UI, and you can see why I think that this is a much better version, just from that stand point.

The bottom half, however, is what I really like. This is the part I use the most often, in order to really see what is going on. I did an ad-hoc demo of the profiler in Dallas, and one of the things that cam out of this was the format that you see on the lower pane. This UI is set to allow you to just copy the query from the profiler and immediately execute a readable, easy to understand query on Management Studio or Toad. Again, another piece where I think that I providing a lot more value than SQL Profiler does.

For quick reference, we put the parameter values on the left of the query, so you can inspect them without having to go into a potentially complex queries to try to figure out what is what.

But this isn't where it ends, let us take a look at the stack trace tab:

image

The stack trace will let you correlate a query and the code that generated it, and not only that, it will take you directly from the query to the code (opening visual studio, loading the file and landing you directly in the place in the code that caused this query to be executed.

Oh, and one more thing...

image

I have over four years of experience working with NHibernate, a time during which I learned quite a bit about what work, what doesn't and what kind of things we should be aware off. The profiler has given me the chance to codify a lot of these patterns, and put them in a way that allow you to have apply early detection and prevention mechanisms.

And one last thing, this time it will really be the last. Session / Entity inspection:

image

You can see exactly what are the entities that were loaded by this session, including counts per entity and all the ids that were loaded.

I hope to be able to open it for beta testing in two to three weeks, and a 1.0 release about a month after that. Pricing is tentatively set at 200$ per user, but this is subject to change.

Print | posted on Tuesday, November 04, 2008 8:16 AM

Feedback


Gravatar

# re: NH Prof: A guided tour 11/4/2008 8:37 AM Marc Brooks

Awesome! I love it! One question and one suggestion:

q: In addition to showing the "latest queries", does it show the worst-performing queries? I would especially like an elapsed-time _and_ a time-per-row ranking available

s: In the generated Detail format mode, emit parameter DECLARE and SET statements that match the values and types used in the mapping. This will catch-out stupid things like VARCHAR(x) colums / NVARCHAR(y) parameter oopsies when pasting into SQL Analyser since the query plan with correctly reflect what happened. Otherwise your use of literals pasted in will incorrectly let SQL server defaulting to "help" or "mask" such issues.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 8:56 AM Krzysztof Kozmic

I'll just say, good luck with the tool.
Will you be posting a little bit about architecting it and design/code decisions you've made. I like this kind of your posts :) They are a great source of knowledge from the front


Gravatar

# re: NH Prof: A guided tour 11/4/2008 9:02 AM Miki Watts

Damn, I want this now! Oren, work faster :)

Seriously, this is awesome, I'm sure that I've got all kinds of bloated querys and such hiding in my application, but finding them is almost not possible. This tool will help me do just that.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 10:54 AM James

How on earth can you be this productive whilst working as a full-time contractor? I'm lucky if I can get in 2 hours a day of programming after work. :-)

Do you not sleep?


Gravatar

# re: NH Prof: A guided tour 11/4/2008 10:55 AM James

I should probably clarify that, I've been keeping an eye on the NHProfiler from your blog posts and it seems you've only been working on it for a couple of weeks.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 10:57 AM Roger

Great!

Wouldn't it also be possible to include mem usage per ISession? I mean the size of the snapshot. That would be a great additional and useful feature I think.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 11:41 AM Tobin Harris

This does look awesome :) i like the idea of suggesting best practices, and the depth of information is brill.

Would there be any value in doing a web-based server-hosted version further down the line? So, you'd point your browser at dev/live server and have access to much of this functionality? I've been working on an SQL IDE that is web based (called Squilbo) and I could see this working in a similar way.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 1:31 PM driesie

Looking good.
One thing I think would be awesome, but maybe a v2 feature is being able to query the statistics "ala nDepend". For example
SELECT query WHERE results > 1000
or
SELECT session WHERE queries > 20
or even better
SELECT query WHERE responsetime(query) > 1000


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:33 PM It's Alive

James,

Your legit question was already answered a long time ago:
kyle.baley.org/...railsWhileTheyreHibernating.aspx


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:39 PM Ayende Rahien

Krzysztof,
Yes, I'll probably discuss this at some length :-)


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:42 PM Ayende Rahien

Tobin,
A web version would be interesting, but I am not sure about the actual usage scenarios.
Sounds like a good topic to explore after v1.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:45 PM Ayende Rahien

Roger,
That information is actually not available from within the CLR.
At the moment, I am trying very hard to do only things which can be done inside the CLR, because the cost of development elsewhere is _high_.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:48 PM Ayende Rahien

James,
I am working on it for a two to three weeks. The secret is that I was able to shell out the UI work for a couple of developers who are really amazing in the UI, leaving me to focus on the actual back end.
The backend itself is structured following the zero friction mode, so I don't get much problem from using it.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:49 PM Ayende Rahien

driesie,
That _would_ be cool, I agree.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 2:56 PM Ayende Rahien

Marc,
I don't actually have this type of information when I am capturing the queries. And since I want to remain DB independent, I am not likely to be able to get it.
If this will be an important feature, I'll add this, but for now, I am focusing on giving high level view, not necessarily all the details


Gravatar

# re: NH Prof: A guided tour 11/4/2008 4:54 PM Sergey Shishkin

Why not NH Contrib?


Gravatar

# re: NH Prof: A guided tour 11/4/2008 4:59 PM Ayende Rahien

Sergey,
This is not an OSS project, it is a commercial one.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 5:02 PM Sergey Shishkin

Oren,
That was actually the question. Why not OSS? NH would benefit from having a tool like this.

Or maybe, you plan to support other ORMappers as well?


Gravatar

# re: NH Prof: A guided tour 11/4/2008 5:04 PM Ayende Rahien

Sergey,
I am investing a LOT of time and money in it.
I would like to recoup my investment and actually get paid for doing the work


Gravatar

# re: NH Prof: A guided tour 11/4/2008 5:15 PM Krzysztof Kozmic

@Ayende
The backend itself is structured following the zero friction mode
That is exactly the kind of thigs I'd love to read about :).
OT. Have you considered writing a book on architecture after you're done with the current one? I'm serious.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 5:20 PM Ayende Rahien

Yes, I'll speak about this.
And books takes up _so much time_, that I don't think I'll commit for another one any time soon


Gravatar

# re: NH Prof: A guided tour 11/4/2008 5:22 PM James L

You know what would be REALLY cool... an extra tab for the underlying database execution plan. Would also be nice if you could group by statement template, e.g. SELECT x,y FROM table WHERE z=? occured 7 times, fastest was 8ms, slowest was 1200ms.


Gravatar

# re: NH Prof: A guided tour 11/4/2008 7:35 PM Miika

Just if you miss it, you are misspelling Session in the left upper pane... Looks great though!


Gravatar

# re: NH Prof: A guided tour 11/4/2008 11:18 PM Simon

perhaps a split the license??
-a commercial one
-and a cheaper one for people only intending to use it only for OSS projects


Gravatar

# re: NH Prof: A guided tour 11/5/2008 1:06 AM Andrew Hallock

Looks incredible. $200 is a bargain.


Gravatar

# re: NH Prof: A guided tour 11/5/2008 1:08 AM Mark Nijhof

Ridicules! Why has everything to be free or very cheap? Open source is great, but look at how much he is already giving to the community, not just the tools/utilities but also all the sharing of knowledge. Stop whining, if you like the tool and want to use it just pay the small fee, it’s not like he is ripping you off.

-Mark


Gravatar

# re: NH Prof: A guided tour 11/5/2008 1:27 AM Thibaut Barrere

I believe you could sell it for more than 250$ and still find a good bunch of interested (and happy) customers and NHibernate users.

Congratulations for your work, it seems awesome!


Gravatar

# re: NH Prof: A guided tour 11/5/2008 4:16 AM Simon

At the risk of starting a flame war i will make one reply regarding the price / license.

First I believe Ayende was asking for feedback and I was making a suggestion. I did not say “$200 is too expensive”.

Secondly while we are on the topic "$200 is a bargain".
Well thats $200US correct? Well $200USD is relative to your locality. Taking into account exchange rates and average income for developers that can be a large amount of money for some countries. For example india or Malaysia. Now I am not pretending to have a solution to this but when pricing software that is targeted at a global audience you should consider what your global audience can afford.

Thirdly “cheaper for open source”.
Many open source projects like to make use of various tools, addins and other software. Whenever you choose a tool to help facilitate development of an OSS you create a barrier of entry. The reason is that, ideally, all contributors will have access to this tool. The larger the cost the higher the barrier or entry. For an example: I have seen some projects recently who state in their guidelines “No resharper warnings in code”. So if I don’t have resharper I cant contribute?

Finally I would pay $200 USD. Even though with the GEC and the drop in our dollar it will now cost me almost 30% more than it would have couple of months ago.


Gravatar

# re: NH Prof: A guided tour 11/5/2008 1:51 PM Neil Mosafi

"The stack trace will let you correlate a query and the code that generated it"

Love it


Gravatar

# re: NH Prof: A guided tour 11/5/2008 3:25 PM Paul Hatcher

Why should you consider a global audience - you only have to consider developers who would actually pay for the software in the first place.

If it was "world-priced" at $50 then he potentially earns much less money since the developers in emerging market countries are unlikely to buy it anyway and you now have to sell 4x the quantity to make up for the price drop.


Gravatar

# re: NH Prof: A guided tour 11/5/2008 7:47 PM Mark Nijhof

Also it is very likely that your target audience (or at least a large part) are actually companies using NHibernate in their development projects. Now for these companies a 200$ price tag is a 'normal' license cost per developer.

So in my eyes 200$ is surely not to much.

My irritation goes to those (and it is not just here, you will see them everywhere) people that never want to pay for anything, even if they most likely can afford it ;) You cannot expect everybody to do everything for free, they have to earn a living too, just be happy with what you do get for free.

And I am sure that if indeed you cannot pay and you are truly using it for Open Source and you are contributing to the community, then you might be able to find a sponsor for it. Hey maybe even Oren would give you a break.

-Mark


Gravatar

# re: NH Prof: A guided tour 11/5/2008 8:26 PM Gian Maria

Great tool, It is really awesome and it could really helps people to better understand how NH is performing for our application, I love the part where you detect problems and gives suggestions :D

Another Great Work from Ayende|

alk.


Gravatar

# re: NH Prof: A guided tour 11/6/2008 3:11 PM Steve

Looks fantastic, a definite must for using NHibernate.

Is the UI done with WPF ?

As mentioned above:
"The backend itself is structured following the zero friction mode"

Please share when you have time!

Will you include a license that includes the source ?


Gravatar

# re: NH Prof: A guided tour 11/6/2008 3:14 PM Ayende Rahien

Steve,
Yes, the UI is WPF.
I'll have a couple of posts about that today.
As for source licensing, probably so, if people really want it.


Gravatar

# re: NH Prof: A guided tour 11/7/2008 4:36 AM JohnLeger

Hey Ayende,

Looks like you have almost all your documentation complete! :)

Hope all is well in NJ

Regards,
J


Gravatar

# re: NH Prof: A guided tour 11/10/2008 1:22 PM Paulo Quicoli

Ayende... you are THE man !


Gravatar

# re: NH Prof: A guided tour 11/11/2008 5:38 PM Gergely Orosz

Really cool project. Actually I'm working on compating NHibernate, Entity Framwework and some other ORM tools in my freetime. Too bad there aren't any tools for other ORM frameworks (at least none I know).


Gravatar

# re: NH Prof: A guided tour 11/11/2008 10:14 PM Matt

Is this tool meant to replace NHibernate Query Analyzer or to compliment it? I noticed that QA hasn't been updated to support NHib 2.0 GA. Is that planned?


Gravatar

# re: NH Prof: A guided tour 11/11/2008 10:19 PM Ayende Rahien

Matt,
I am no longer maintaining NHQA. Mostly because I don't have any interest in doing so.
If you want to send a patch that would do that, I would be grateful


Gravatar

# re: NH Prof: A guided tour 11/11/2008 10:50 PM Matt

But will NH Prof have some of that functionality? Specifically around transposing SQL and HQL queries? That is a very useful function.


Gravatar

# re: NH Prof: A guided tour 11/11/2008 10:58 PM Ayende Rahien

Matt,
Then functionality will be there, but not directly.


Gravatar

# re: NH Prof: A guided tour 11/12/2008 8:16 PM Michel

Where i can get link to download and try this soft?


Gravatar

# re: NH Prof: A guided tour 11/12/2008 9:32 PM Ayende Rahien

You'll be able in a few weeks.


Gravatar

# re: NH Prof: A guided tour 12/17/2008 11:51 AM Igor

Any news about community available version of NH Prof? :)

Comments have been closed on this topic.