The NHibernate Profiler
This is speculative at the moment, just to be clear.
I am thinking about creating a profiler for NHibernate. This came out of the common need to actually get a good view about what is going on with NHibernate.
This is intended to be a commercial project.
I have a feature set in mind, but I would rather hear from you if you think that it is a tool that you would use (and buy) and what kind of features do you expect such a tool to have?
And, to forestall the nitpickers, I am well aware of SQL Profiler.
Comments
I know you are aware of it - but your tool would have to do something quite special for me (to buy it), considering I already know my way around SQL Profiler.
To me this seems like an excellent idea. Some people tend to forget that not the whole world is using SQL Server (unfortunately).
Something that I personally would find helpful is a command-line tool that can be used in a daily build/CI build in order to determine which (unique) queries (for a particular session) are executed against the database. It would be nice to include a query plan or a list of queries that can be improved.
"Your session used 7 queries to load the following entities: ... . Considering using the following HQL query instead: ... "
Would it be possible to write something like this in Java? That way it's cross platform and you could perhaps make it work on Hibernate a swell as NHibernate. You'd have a much larger market there and people could run it natively on a mac as well as Windows PC.
SQL Profiler is good for metrics like execution time queries, execution plan (what indexes were used) etc, so I would expect to see NHibernate specific things like:
(warning: stream of consciousness ramblings)
queries per session
queries per thread
queries per web request
duplicate queries per session
number of lazy loads
of times eager loaded data not used
a list of each query and how many times they were run
average time between rerun of same query
metrics on opening & closing sessions
average number of rows returned
max number of rows returned by a query
basically, let SQL profiler tell you how to optimize a query and let NHibernate profiler tell you how to optimize mappings.
Also, some SLA tools would be cool.
Mike,
What do you mean by SLA? The page perf module?
I was thinking of an extensions to NHibernate that could take various actions when the database is performing slowly, not responding, erroring, or returning garbage.
Actions could be:
send alerts
return "last known good (cached) result" for failed or slow reads
circuit breaker mode so more operations are not sent the db (maybe for deadlock situations)
queue and throttle writes and updates if they take too long
Maybe these concepts are more appropriate for the domain layer... I haven't really thought this through :)
@Ayende:
Could we get an iron strength Linq 2 NHibernate instead? Any idea what level-of-effort is required to get that thing to production/support-ready quality?
(NOTE: And yes, I do mean that I would be willing to pay some money for NHibernate support in order to get Linq2Nhib)
Chad,
It is two to three months of development.
If someone is willing to pay for it, that would make it move faster :-)
Chad,
I am delighted to hear that you are willing to pay.
I just want to make sure that we are clear about the scope, this is a big undertaking.
I'd definitely be interested in an NH profiler, and I'd definitely pay, if it helped me write better NH queries. Sounds like a great idea. Trawling through the Output window is a p-i-t-a.
Hi Ayende. Really good idea - the product is much needed. I would have no problem paying up to 500$ for it if I could the following info:
Besides of the aggregated information for the whole subtree it should also be possible to get the information just for a subtree of entities which was loaded together because of a lazy access to an entity / collection.
Really looking forward to the product.
All the best
Carsten
I was thinking about NHibernate visual scheme generator. Right now LINQ2DB does for you 90% of generation and I think for rapid development the same can be done too.
So long as it was reasonably priced, I'd certainly look at buying something like this. I think part of the fear of adopting any ORM is not knowing what's going on under the scenes. This could make NH an easier sell to my collegues.
@Chad
"Could we get an iron strength Linq 2 NHibernate instead? Any idea what level-of-effort is required to get that thing to production/support-ready quality?"
How much are you willing to pay? :) I could port our linq to llblgen pro provider to linq to nhibernate within a reasonable amount of time. Which is something we are considering for v3 of llblgen pro as it will support nhibernate as well. Porting won't be a big undertaking as the majority of the work is generic code.
@Ayende:
Do good research on what people are willing to pay for. You'll be surprised that the majority of people won't be willing to pay money for a toolkit even if it helps them a great deal. In the area you're looking at, it's especially difficult because nhibernate is free and people chose not to pick up a commercial O/R mapper because nhibernate offered its features for free.
There's a way to make this work, but I'll discuss this only off-line with you if you want to.
@chad. I forgot: our provider is about 1.2MB of C# code, and I'm with Ayende on this: it is a big undertaking/project, think about 6-8 months full time dev if you start from scratch.
Frans,
Some of the work that needs to be done in NH is opening new code paths for this to work. The current query mechanisms are all tied pretty strongly to the way they currently work.
And I think that there is a market for tools around NHibernate. That is certainly a common model for OSS projects.
Depending on the licensing model, for a profiler, I'd consider £300-1000 ok depending on the feature set. Less would obviously be better, and if it's per developer, then a lot less. I'd see us (BBC Worldwide) using it right now (well, during the last 3 weeks) to tune an app while load testing it and putting the final touches on it.
I'd love to see the more NH specific stuff - objects cached in memory, time to execute a query from NH's point of view, not from SQL's. A realtime monitor of whats going on - less info than the log4net DEBUG dump, which is close to useless as it has too much info, but more than INFO. eg, ran this HQL/query, got this many things back, x% came from cache, cache is now 456 objects, 34 are of the type just returned etc.
A visual schema generator would be good too, and also (tho I think hibernating rhino's did a post on it) migrations... oh, that'd save a bit of time, tho I dont know how many people would pay for it :(
BTW I wouldn't expect this to be real time, all the time - it'd be nice to have it be able to "attach" to my program at runtime (we do web apps), but even just being able to do it in a dev sandbox would be a fantastic start.
Lost of good info above tho. Not sure I care about linq2nh tho, but a lot of people appear to.
Yes, I would consider buying it if some of the features that "Mike" has suggested are in it (and I also trust that if Ayende thinks a feature is useful, it probably is).
Good tool support would probably feed back into the popularity of NHibernate itself.
I think the potential for a commercial product is more than some have hinted. Partiaularly with NHibernate - which pleases so quickly but then also confounds so many at the mid-to-high level usage. These are buyers, and judging from the success of Manning's "NHibernate in Action" book, there is probably a significant number of them willing to fork out money to polish what they're doing.
I love the idea, and I hope you will find the resources to make it, especially because I really think NHibernate is really lacking (visual) tools for making it clearer what happens behind the scenes..
I think it is very important to have tools like this to make the NHibernate community grow.
By the way, I finally upgraded my very large project to NHibernate 2.0, and I would like to hear when there will be a Query Analyzer for NHibernate 2.0 ?
Query Analyzer is a very valuable tool -not only because of what it does, but also because of it is one of the few visual tools there exists, and it sends a signal about how much NHibernate is up-to-date.. If there is no tools available, a lot of people will not be choosing NHibernate.
Jonas,
The query analyzer is not something that I am interested it. If you want to submit a patch to upgrade that to 2.0, I would be grateful
This sounds like a great idea. I would definitely pay for this for my commercial projects at work. Would there be a discount/free version for open source/personal projects?
I'd really like a feature that could suggest improvements in queries/mapping based on the analysed session.
Cheers
Comment preview