Ayende @ Rahien

Unnatural acts on source code

NH Prof: Post v1.0 Ideas

This is just a high level list of features that I want to plug into NH Prof, now that the v1.0 mark is behind us.

  • Show database query plan for statements
  • Allow occasionally connected profiling, also known as production profiling – note, must be secured(!)
  • Output reports as PDF/HTML
  • Exporting reports
  • NHibernate Search integration
  • NHibernate Shards integration

This isn’t everything, but it would serve as a good place for discussion.

Licensing note: this would probably go to v1.x, which everyone who has a beta or v1.0 license can upgrade to at no additional cost.

Comments

Vincent
09/13/2009 05:45 PM by
Vincent

Cool! Especially 1,2 and 5 are most appreciated!

todd
09/13/2009 06:18 PM by
todd

Excuse my ignorance, but what is the difference between #1 (Show database query plan for statements) and #5 (Display query plan in the DB)?

I love the idea of #2, esp. if there would be a way to log the profiling or a way to produce periodic logs/reports.

Paul
09/13/2009 06:23 PM by
Paul

From where I'm sitting, number 1 is a killer feature.

If you could somehow store them and search for things like table scans - and rank, based on size of table, execution time, number of times called etc, it could be extremely useful!

Ayende Rahien
09/13/2009 06:30 PM by
Ayende Rahien

Paul,

Query plans is pretty costly in terms of performance, you have to hit the DB for each query.

You also have issues with deciding things based on DB that the devs have access to vs. the production DB.

todd
09/13/2009 07:10 PM by
todd

Oren,

The idea of production profiling is a great feature. Some issues only rear their ugly head once the app is under load. If there were a way to aggregate the production profiling over an extended period and then be able to analyze metrics across the aggregation; that would be a wonderful addition to an already wonderful tool. NHProf has helped me enormously in my education of NHibernate.

Francisco Lozano
09/13/2009 07:12 PM by
Francisco Lozano

Just two comments?

  • Query plans would be a SQLServer-only feature?

  • 2 would be a killer feature, really.

  • Glad to hear that NH Shards is becoming a reality!

Ayende Rahien
09/13/2009 07:21 PM by
Ayende Rahien

Francisco,

I am going to try to make query plans a feature that would support SQL Server, Oracle & MySQL.

Haven't looked at it enough to tell if this is possible, but I hope so

Valeriu Caraulean
09/13/2009 07:39 PM by
Valeriu Caraulean

Is support for multiple session factories dismissed completely? It's a feature that will ease essentially the use of NHProf with our projects...

I've seen that you have issues with how NHibernate works, so this isn't possible at the moment. Are you going to fix that any time soon?

Ayende Rahien
09/13/2009 07:45 PM by
Ayende Rahien

Valeriu,

Define support for multiple session factories, please.

Valeriu Caraulean
09/13/2009 08:14 PM by
Valeriu Caraulean

Ayende, here you go:

As an application developer:

  • when a ISessionFactory is instantiated (first one, second, n-th) i want to

    • see that in NHProf
  • when having multiple instances of ISessionFactories i want to

    • differentiate them by "assigned" name or database name.

    • clearly view statistics of any selected Session Factory

    • see which session factory was used to create any particular session.

    • see all sessions of one session factory grouped together

    • have connection strings to be set for each of session factories

May be more requirements can be formulated, but having factory statistics and grouping session by factory are the features we definitely would like to have.

It's OK also to have to write an "adapter/provider" for that, so it can help profiler figure that out.

James L
09/13/2009 08:23 PM by
James L

Db query plans would be superb

Anders
09/14/2009 05:53 AM by
Anders

How about autoupdate (for 1.x and build releases)?

Ayende Rahien
09/14/2009 06:00 AM by
Ayende Rahien

Anders,

auto update is already there.

Gauthier Segay
09/14/2009 08:41 PM by
Gauthier Segay

Ayende, about query plan

won't it fit a sister NH project, providing a generic RDBMS abstraction over query plan information?

Otherwise, the features looks good, maybe it would be better to have a stable (and documented) intermediate format for exports and let the community add on top of that (PDF, HTML, etc.) instead of supporting theses right from the application (which imply more dependencies for some formats)

Ayende Rahien
09/14/2009 08:56 PM by
Ayende Rahien

Gauthier,

Yes, it would probably be easier to just output XML and let someone else worry about this. I might try crowd sourcing it.

About the query plan idea, I am not sure what you mean by a sister project.

Gauthier Segay
09/14/2009 09:16 PM by
Gauthier Segay

On the query plan / NH sister project, (prepare to steer away from the contents of the post) the idea would be to have a NH contrib or subproject building an abstraction about how a query plan should be exposed to a reporting API, it looks pretty much like a n-tree with some semantics about costs and operations (I'm over simplifying)

With a rough idea of this abstraction in place, it should be possible to start working on baremetal implementations to perform query plan and parse it into this n-tree for several DB implementations.

On the same verge, there was this interesting work:

fabiomaulo.blogspot.com/.../...-management-in.html

I think NHibernate may provide (sometime in future) a generic abstraction layer over things like FK constraint failure, named check constraint failure, etc.

All of this is from a "coward" user point of view so I'm not in position to contribute a patch, however you could as well demonstrate why such ideas are crazy / YAGNI

Ayende Rahien
09/15/2009 08:41 PM by
Ayende Rahien

Gauthier,

I am not sure what NH is supposed to do with a query plan. It is not its job.

We already provide the abstraction layer, with the exception management scheme.

Russell Garner
10/05/2009 09:42 AM by
Russell Garner

Just bought NH Prof - lovely tool.

Here's a thing I'd love which would be a big win for me but hopefully not that difficult for you - the ability to name the session in the session pane. While showing new devs the features of NH in general, it would be useful to change code and label what we were doing at the time, then compare and contrast. ANTS profiler allows naming sections of your session and it's one of my most treasured features (even when not teaching new devs).

Ayende Rahien
10/05/2009 09:44 AM by
Ayende Rahien

Russell,

This is something that we actually did have at some point. I'll add it again

Russell Garner
10/20/2009 11:54 AM by
Russell Garner

Actually, would be even nicer if we could name sessions through code by either telling a logger or NHProf's own statics that we're about to do so. Getting pressure to provide DBAs with a "data access catalogue" that help with their tuning concerns, and we already have a lot of Fluent NH "PersistenceSpecification"-style tests, so it would be great to be able to say "and the next session is how we store and retrieve object X".

Perhaps there would be problems with thread safety here, but in this case where it's a single test runner thread the wins would be large for us.

Comments have been closed on this topic.