NHProf not detecting Update Batches when running against Oracle

10 views
Skip to first unread message

James Kovacs

unread,
Dec 17, 2009, 3:45:24 PM12/17/09
to nhp...@googlegroups.com
NHProf is not detecting update batches (set through adonet.batch_size) when run against Oracle. Oracle does support update batches if using ODP.NET and OracleDataClient. (It does not work with Microsoft's System.Data.OracleClient.) The results in NHProf look something like this:

INSERT INTO <TABLE> ... (no duration)
INSERT INTO <TABLE> ... 1 ms              <-- Parameters are identical

For collections:
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#0)
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#1)
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#2)
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#3) <-- These don't look batched.
INSERT INTO <COLLECTION_TABLE> ... (no duration - item#3) <-- Last item is always duplicated twice.

Here's the reason... The OracleDataClientBatchingBatcher puts out log messages in a slightly different (and erroneous) format than the SqlClientBatchingBatcher, which results in NHProf not detecting that batches are being executed. In the OracleDataClientBatchingBatcher, when an OracleCommand is created and batched, it writes out the SQL text and parameters. To NHProf, this looks like a command execution. In reality, it is appended to the current batch. When the batch is actually executed, the OracleDataClientBatchingBatcher writes out the last command and parameters rather than the full batch, which makes it look like the statement is being re-executed. In reality, the entire batch is being executed against the database. Needless to say, this is rather confusing.

This should be fixed in NHibernate, but that doesn't help everyone running with current versions of NHibernate. Just wondering if you can do anything on the parsing end to display better information in the profiler.

BTW - I've added this as issue 2047 in NHibernate's JIRA.

http://nhjira.koah.net/browse/NH-2047

James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

Ayende Rahien

unread,
Dec 17, 2009, 3:47:10 PM12/17/09
to nhp...@googlegroups.com
Saw that, I'll take care of it soon

--

You received this message because you are subscribed to the Google Groups "nhprof" group.
To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.

Bobby Johnson

unread,
Dec 17, 2009, 4:08:48 PM12/17/09
to nhp...@googlegroups.com
Wow, I wish I could get bug reports from my users like this. 8)

--

You received this message because you are subscribed to the Google Groups "nhprof" group.
To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.



--
"The explanation requiring the fewest assumptions is most likely to be correct."

- Occam’s Razor
http://en.wikipedia.org/wiki/Occam's_Razor

Ayende Rahien

unread,
Dec 17, 2009, 4:13:46 PM12/17/09
to nhp...@googlegroups.com
Well, the first step is to make James one of yours users...

James Kovacs

unread,
Dec 17, 2009, 11:38:44 PM12/17/09
to nhp...@googlegroups.com
LOL. :) I spent a few hours figuring out the root cause (and ended up submitting patches to Fluent NHibernate and NHibernate in the process of my investigations). The least I could do is provide a detailed bug report. Higher probability that the issue will get fixed and why waste Oren's time figuring out what I already investigated!


James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)


Ayende Rahien

unread,
Jan 6, 2010, 3:12:58 PM1/6/10
to nhp...@googlegroups.com
Fixed in NHibernate, FYI.
Please note that this is fixed in the trunk.

James Kovacs

unread,
Jan 6, 2010, 3:18:02 PM1/6/10
to nhp...@googlegroups.com
Excellent. Thanks for letting us know. I'll take a look at NH trunk. Were any changes required in NHProf? Or will the current version of NHProf correctly display update batches with Oracle?


James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)


Ayende Rahien

unread,
Jan 6, 2010, 3:21:30 PM1/6/10
to nhp...@googlegroups.com
No changes required to NH Prof, the format is the same
Reply all
Reply to author
Forward
0 new messages