<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Episode 38: NHibernate performance with Ayende, David Penton, and Ben Scheirman</title>
	<atom:link href="http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/feed/" rel="self" type="application/rss+xml" />
	<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/</link>
	<description>The Herding Code Podcast</description>
	<lastBuildDate>Thu, 13 Jun 2013 12:10:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Augusta</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-106820</link>
		<dc:creator>Augusta</dc:creator>
		<pubDate>Tue, 06 Nov 2012 07:23:26 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-106820</guid>
		<description><![CDATA[&lt;strong&gt;Augusta...&lt;/strong&gt;

Episode 38: NHibernate performance with Ayende, David Penton, and Ben Scheirman...]]></description>
		<content:encoded><![CDATA[<p><strong>Augusta&#8230;</strong></p>
<p>Episode 38: NHibernate performance with Ayende, David Penton, and Ben Scheirman&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Americas Cardroom Poker</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-103300</link>
		<dc:creator>Americas Cardroom Poker</dc:creator>
		<pubDate>Sun, 23 Sep 2012 04:35:38 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-103300</guid>
		<description><![CDATA[&lt;strong&gt;Americas Cardroom Poker...&lt;/strong&gt;

Episode 38: NHibernate performance with Ayende, David Penton, and Ben Scheirman...]]></description>
		<content:encoded><![CDATA[<p><strong>Americas Cardroom Poker&#8230;</strong></p>
<p>Episode 38: NHibernate performance with Ayende, David Penton, and Ben Scheirman&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yesterday's news &#124; NHibernate parameter sizes controversy</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-7238</link>
		<dc:creator>Yesterday's news &#124; NHibernate parameter sizes controversy</dc:creator>
		<pubDate>Wed, 28 Oct 2009 15:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-7238</guid>
		<description><![CDATA[[...] 3/13, the question arises in Herding Code podcast, episode #38 with [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 3/13, the question arises in Herding Code podcast, episode #38 with [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Auger</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-1549</link>
		<dc:creator>Daniel Auger</dc:creator>
		<pubDate>Thu, 19 Mar 2009 01:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-1549</guid>
		<description><![CDATA[This was a fantastic podcast. I really hope this spurns a more open conversation between programmers and DBAs on the topic of ORM. I look forward to seeing what input David has in the future as he could do a lot of good for the community.

Oddly enough David&#039;s first point regarding the effect of differentiating parameter lengths on Sql Server&#039;s execution plan optimization was something I recently asked about on the NH user group. It turns out there is a setting that negates the problem.

http://groups.google.com/group/nhusers/browse_thread/thread/7a0a341184796836#]]></description>
		<content:encoded><![CDATA[<p>This was a fantastic podcast. I really hope this spurns a more open conversation between programmers and DBAs on the topic of ORM. I look forward to seeing what input David has in the future as he could do a lot of good for the community.</p>
<p>Oddly enough David&#8217;s first point regarding the effect of differentiating parameter lengths on Sql Server&#8217;s execution plan optimization was something I recently asked about on the NH user group. It turns out there is a setting that negates the problem.</p>
<p><a href="http://groups.google.com/group/nhusers/browse_thread/thread/7a0a341184796836#" rel="nofollow">http://groups.google.com/group/nhusers/browse_thread/thread/7a0a341184796836#</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas Whitehead</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-1542</link>
		<dc:creator>Nicholas Whitehead</dc:creator>
		<pubDate>Wed, 18 Mar 2009 12:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-1542</guid>
		<description><![CDATA[Very interesting podcast. I am primarily a Java developer and I have made heavy use of Hibernate/Oracle. ( I plan on becoming a .Net expert by listening to lots of .Net podcasts. Any one see an issue with that ?)

The friendly-and-professional face-off between ORM using developers and DBAs is very familiar to me, and while I operate almost entirely on the Dev side, I was an Oracle DBA in a former life. Here&#039;s some observations which I believe will be also relevant to NHibernate and SQLServer (or almost any RDBMS):

Background: We had a CRM like database. The model was quite simple with less than 20 tables, but several of them were big (10+ million rows) and we developed a pseudo-Query-By-Example web interface as part of a larger application. All the key tables were modeled in Hibernate and we used JBoss Cache as the underlying secondary level cache.

1. Developers implemented the QBE application purely through Hibernate using an XML defined wrapper around the criteria query API. Consequently, the database access was quite abstracted with the first few rounds of access code focused on &quot;What&quot; and not &quot;How&quot;. What I found was that Hibernate generated this incredibly complicated but surprisingly effective and elegant SQL.

2. Had the developers been using straight SQL or stored procedures, I am convinced the access would have required multiple queries and some data &quot;massaging&quot; to get the same data format returned to the browser. I tend to adopt the axiom that one query returning &quot;many&quot; rows is always preferable to multiple queries returning &quot;fewer&quot; rows. I do not believe that most developers would write the SQL that Hibernate generated.

3. Based on the ease of use of the XML criteria API, we were anxious to keep it, even though in early days we did experience some scenarios where the SQL generated was dirt-slow, and many others where it was slightly below adequate. Consequently, I donned my DBA hat and started to investigate what I could do on the Oracle side to better support this query engine. I think that applications that require some level of user defined queries (and indirectly, user defined SQL), it is quite difficult to squeeze out performant queries without implementing an arsenal of database side optimizations that may be beyond the norm in a more static type application. We found the combination of the following pretty much eliminated all our issues:

4. Table partitioning. We were fortunate that our database had several very natural demarcations in the form of region codes (most users only worked in one region out of many) and effective date (most users only worked on the current month&#039;s worth of records that spanned a whole year). We created a synthetic column for effective-month and populated it with a trigger off the effective time stamp column in the same row. We partitioned tables according to this effective month and the region code. No change on the client side, massive change (for the better) in performance.

5. Higher index coverage: On a table with 18 columns, many which may be used in a query, but not always the same ones, we needed multiple (non-unique) indexes that might ordinarily look redundant or excessive. This took some trial and error but we noticed little overhead on having additional indexes, and we dropped indexes that turned out not to get much usage. I created a tool that took the raw XML query, converted to a criteria API call, executed it and generated a database execution plan. I taught the developers how to interpret it and whenever they saw some consistent issue, we investigated to see if a new index was warranted.

6. Other synthetic columns were introduced in order to create superior indexes and coverage. In some cases, but not all, this was preferable to using functional indexes, which also worked well to resolve some corner cases.

7. One specific issue emerged which revolved around the Oracle cost based optimizer and partitioned tables. I think this issue can also occur in SQLServer, based on something I heard on the StackOverflow.com podcast. The issue is that when using prepared statements (using bind variables instead of literals), the execution plan would be locked in and might be bound to a specific partition local index. The SQL engine does not notice that the next query with the same SQL but different binds will not be performant with the same plan. To resolve this, we added an option to the XML-&gt; Criteria syntax, the ability to define an argument as a literal so when the SQL is built, Hibernate would generate the SQL with this one column argument defined as a literal instead of a bind. (usually primary keys or partition keys) Awkward at first, and arguably inelegant, it completely spanked the problem.

8. On a note related to #5 above, I think it is critical for the developers to be able see (and copy and test) the SQL that is generated by Hibernate during an application session. Although generated SQL (and binds) can be logged in Hibernate, we provided the developers a few enhanced tools to do this.

The bottom line, as always,  is that the most performant systems will result from cooperation between developers and DBAs. Both can bring creativity and expertise to the table that are complimentary not contra-indicated.

Cheers. Look forward to the next one.

//Nicholas]]></description>
		<content:encoded><![CDATA[<p>Very interesting podcast. I am primarily a Java developer and I have made heavy use of Hibernate/Oracle. ( I plan on becoming a .Net expert by listening to lots of .Net podcasts. Any one see an issue with that ?)</p>
<p>The friendly-and-professional face-off between ORM using developers and DBAs is very familiar to me, and while I operate almost entirely on the Dev side, I was an Oracle DBA in a former life. Here&#8217;s some observations which I believe will be also relevant to NHibernate and SQLServer (or almost any RDBMS):</p>
<p>Background: We had a CRM like database. The model was quite simple with less than 20 tables, but several of them were big (10+ million rows) and we developed a pseudo-Query-By-Example web interface as part of a larger application. All the key tables were modeled in Hibernate and we used JBoss Cache as the underlying secondary level cache.</p>
<p>1. Developers implemented the QBE application purely through Hibernate using an XML defined wrapper around the criteria query API. Consequently, the database access was quite abstracted with the first few rounds of access code focused on &#8220;What&#8221; and not &#8220;How&#8221;. What I found was that Hibernate generated this incredibly complicated but surprisingly effective and elegant SQL.</p>
<p>2. Had the developers been using straight SQL or stored procedures, I am convinced the access would have required multiple queries and some data &#8220;massaging&#8221; to get the same data format returned to the browser. I tend to adopt the axiom that one query returning &#8220;many&#8221; rows is always preferable to multiple queries returning &#8220;fewer&#8221; rows. I do not believe that most developers would write the SQL that Hibernate generated.</p>
<p>3. Based on the ease of use of the XML criteria API, we were anxious to keep it, even though in early days we did experience some scenarios where the SQL generated was dirt-slow, and many others where it was slightly below adequate. Consequently, I donned my DBA hat and started to investigate what I could do on the Oracle side to better support this query engine. I think that applications that require some level of user defined queries (and indirectly, user defined SQL), it is quite difficult to squeeze out performant queries without implementing an arsenal of database side optimizations that may be beyond the norm in a more static type application. We found the combination of the following pretty much eliminated all our issues:</p>
<p>4. Table partitioning. We were fortunate that our database had several very natural demarcations in the form of region codes (most users only worked in one region out of many) and effective date (most users only worked on the current month&#8217;s worth of records that spanned a whole year). We created a synthetic column for effective-month and populated it with a trigger off the effective time stamp column in the same row. We partitioned tables according to this effective month and the region code. No change on the client side, massive change (for the better) in performance.</p>
<p>5. Higher index coverage: On a table with 18 columns, many which may be used in a query, but not always the same ones, we needed multiple (non-unique) indexes that might ordinarily look redundant or excessive. This took some trial and error but we noticed little overhead on having additional indexes, and we dropped indexes that turned out not to get much usage. I created a tool that took the raw XML query, converted to a criteria API call, executed it and generated a database execution plan. I taught the developers how to interpret it and whenever they saw some consistent issue, we investigated to see if a new index was warranted.</p>
<p>6. Other synthetic columns were introduced in order to create superior indexes and coverage. In some cases, but not all, this was preferable to using functional indexes, which also worked well to resolve some corner cases.</p>
<p>7. One specific issue emerged which revolved around the Oracle cost based optimizer and partitioned tables. I think this issue can also occur in SQLServer, based on something I heard on the StackOverflow.com podcast. The issue is that when using prepared statements (using bind variables instead of literals), the execution plan would be locked in and might be bound to a specific partition local index. The SQL engine does not notice that the next query with the same SQL but different binds will not be performant with the same plan. To resolve this, we added an option to the XML-&gt; Criteria syntax, the ability to define an argument as a literal so when the SQL is built, Hibernate would generate the SQL with this one column argument defined as a literal instead of a bind. (usually primary keys or partition keys) Awkward at first, and arguably inelegant, it completely spanked the problem.</p>
<p>8. On a note related to #5 above, I think it is critical for the developers to be able see (and copy and test) the SQL that is generated by Hibernate during an application session. Although generated SQL (and binds) can be logged in Hibernate, we provided the developers a few enhanced tools to do this.</p>
<p>The bottom line, as always,  is that the most performant systems will result from cooperation between developers and DBAs. Both can bring creativity and expertise to the table that are complimentary not contra-indicated.</p>
<p>Cheers. Look forward to the next one.</p>
<p>//Nicholas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jswanson</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-1502</link>
		<dc:creator>jswanson</dc:creator>
		<pubDate>Mon, 16 Mar 2009 19:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-1502</guid>
		<description><![CDATA[Some very interesting points later in session. First part was painful to listen to. David jumps into details of very specific issues without exploring big picture first.]]></description>
		<content:encoded><![CDATA[<p>Some very interesting points later in session. First part was painful to listen to. David jumps into details of very specific issues without exploring big picture first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #307</title>
		<link>http://herdingcode.com/nhibernate-performance-with-ayende-david-penton-and-ben-scheirman/comment-page-1/#comment-1500</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #307</dc:creator>
		<pubDate>Mon, 16 Mar 2009 08:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://herdingcode.com/?p=171#comment-1500</guid>
		<description><![CDATA[[...] NHibernate performance with Ayende, David Penton, and Ben Scheirman - The Herding Code podcast listens in on a late night debate on NHibernate peformance, and publishes the discussion - I&#8217;ve not yet listened to this, but certainly am looking forward to it [...]]]></description>
		<content:encoded><![CDATA[<p>[...] NHibernate performance with Ayende, David Penton, and Ben Scheirman &#8211; The Herding Code podcast listens in on a late night debate on NHibernate peformance, and publishes the discussion &#8211; I&#8217;ve not yet listened to this, but certainly am looking forward to it [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk
Database Caching 2/12 queries in 0.005 seconds using disk
Object Caching 422/422 objects using disk

 Served from: herdingcode.com @ 2013-06-18 00:30:03 by W3 Total Cache -->