<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx</link><description>Rather than spending a lot of time on explaining the details of the garbage collector, I'll refer you to Maoni's blog for some very interesting reading, but in this case study I want to show you how to get to the bottom of a problem with high CPU in the</description><dc:language>sv-SE</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#643454</link><pubDate>Fri, 23 Jun 2006 02:59:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:643454</guid><dc:creator>stephen patten</dc:creator><description>Glad you're back!</description></item><item><title>The evils of dynamically building strings with += and GC</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#643506</link><pubDate>Fri, 23 Jun 2006 03:47:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:643506</guid><dc:creator>Robert Seder</dc:creator><description>I ran across this post:&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/tess/archive/2006/06/22/643309.aspx"&gt;http://blogs.msdn.com/tess/archive/2006/06/22/643309.aspx&lt;/a&gt;&lt;br&gt;She went into painfully...</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#643572</link><pubDate>Fri, 23 Jun 2006 05:20:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:643572</guid><dc:creator>Fernando Tubio</dc:creator><description>As always, a very enlightening article.&lt;br&gt;&lt;br&gt;Just a minor quibble about the &amp;quot;Hello world&amp;quot; string concatenation example you give towards the end. In that case the compiler takes care of the concatenation of the string literals and only a single call to String.Concat( string, string ) is actually performed. Even if the concatenation involved variables, as in str += s1 + s2 + s3 + s4, the compiler first builds an array to hold the individual variables and then calls String.Concat( string [] ).&lt;br&gt;</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#643797</link><pubDate>Fri, 23 Jun 2006 09:56:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:643797</guid><dc:creator>AlexP</dc:creator><description>Hi, Tess.&lt;br&gt;It's great article. Very interesting for me. Look forward for another new :)</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#644233</link><pubDate>Fri, 23 Jun 2006 16:42:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:644233</guid><dc:creator>James Bolles</dc:creator><description>Thanks for this post, Tess. &amp;nbsp;I am in a similar situation where I have large amount of memory being allocated during web service processing. &amp;nbsp;Have you ever experienced cases where a multi-threaded application running on a server with multiple CPUs continues to allocate memory even when profilers are stating the objects have been collected? &amp;nbsp;We have some value types in our logic that are referenced by many threads and it seems that some of those value types are still in memory even after they should be deleted. &amp;nbsp;&lt;br&gt;&lt;br&gt;Keep posting your findings. &amp;nbsp;Your blog has helped me to learn how powerful and useful WinDbg can be for production support.</description></item><item><title>Interesting Finds: June 23, 2006 AM edition</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#644252</link><pubDate>Fri, 23 Jun 2006 17:07:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:644252</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>Interesting Finds: June 23, 2006 AM edition</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#644261</link><pubDate>Fri, 23 Jun 2006 17:09:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:644261</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#644564</link><pubDate>Fri, 23 Jun 2006 20:56:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:644564</guid><dc:creator>snaveen</dc:creator><description>Hi,&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cool post. Another way to identify the cause of the objects in the LOH is to have a “bp on mscorwks!gc_heap::allocate_large_object” &amp;nbsp;something like this bp 791c4fcd &amp;quot;!clrstack;.echo *********Allocation of large object heap***********;g&amp;quot;. This should help identifying the objects that are getting allocated in the LOH.&lt;br&gt;&lt;br&gt;Naveen&lt;br&gt;</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#647085</link><pubDate>Mon, 26 Jun 2006 09:13:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:647085</guid><dc:creator>Tess</dc:creator><description>Thanks for the note on the Hello world sample Fernando, that was news to me, but good news nevertheless:)</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#647087</link><pubDate>Mon, 26 Jun 2006 09:21:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:647087</guid><dc:creator>Tess</dc:creator><description>HI James,&lt;br&gt;&lt;br&gt;I am not sure exactly why this is happening in your case and how the particular profilers determine that it is deleted. &amp;nbsp;I would look at if it is actually stating that it is deleted or just un-rooted, in which case it might not really be garbage collected yet? &amp;nbsp;Also perhaps it is that you are pinning objects and leaving a lot of free space. &amp;nbsp; </description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#647088</link><pubDate>Mon, 26 Jun 2006 09:22:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:647088</guid><dc:creator>Tess</dc:creator><description>Cool comment Naveen, &lt;br&gt;&lt;br&gt;that is definitely worth running in a test environment if you are looking at high usage of the LOH. </description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#775484</link><pubDate>Thu, 28 Sep 2006 17:26:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:775484</guid><dc:creator>Howard</dc:creator><description>I've got an application which uses 2 app pools on the same machine, so I've got 2 w3wp processes. Ok, nothing wrong with that except then when I try to look at the .NET counters as per Tess's excellent (again) article they show up as w3wp and w3wp#1.&lt;br&gt;&lt;br&gt;Does anybody know a way to correlate the PID, or App Pool or anything to the instance name shown in Perf Mon so I can tell which ones which?&lt;br&gt;&lt;br&gt;Thanks</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#776601</link><pubDate>Fri, 29 Sep 2006 09:35:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:776601</guid><dc:creator>Tess</dc:creator><description>If you look at the process counter it has an id correspoding to each process that you can correlate the other counters with.</description></item><item><title>.NET Hang Debugging Walkthrough</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#831253</link><pubDate>Mon, 16 Oct 2006 15:31:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:831253</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;I have talked about a number of different hang/performance issues in my posts. This post is a generic&lt;/p&gt;</description></item><item><title>.NET Hang Debugging Walkthrough</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#831257</link><pubDate>Mon, 16 Oct 2006 15:32:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:831257</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;I have talked about a number of different hang/performance issues in my posts. This post is a generic&lt;/p&gt;
</description></item><item><title>ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#1141328</link><pubDate>Fri, 24 Nov 2006 18:48:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1141328</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;I get enough issues relating to bad perf caused by large viewstate that I felt like it is time to dedicate&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#1170855</link><pubDate>Wed, 29 Nov 2006 13:35:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1170855</guid><dc:creator>philippe</dc:creator><description>&lt;p&gt;Excellent article!&lt;/p&gt;
&lt;p&gt;We are also in a similar situation. Our code utlise some wrappers to call some native C code and if we build the wrappers in C# ie in manaed code then the server hangs within a few minutes as they are too many alloc for the GC to keep up. If we build the wrappers using __pin and Marshall then the web servers are ok but %Time in GC over around 80% with a CPUI load at 75% in .NET2.0.&lt;/p&gt;
&lt;p&gt;The exact same app in .NET1.1 does not experience any of this! Any clues here?&lt;/p&gt;
&lt;p&gt;Your help would be greatly appreciated.&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#1839388</link><pubDate>Fri, 09 Mar 2007 00:17:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1839388</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Ah, to have your understanding... &amp;nbsp;Currently our production app is experiencing almost exactly this issue. &amp;nbsp;Our GC 0,1, and 2 are all in lock step after all allocation seems to be done. &amp;nbsp;We're allocating a bunch (emphasis on bunch) of small things (around 400,000 a second) at different memory sizes but jumping to 30MB/sec at one point. &amp;nbsp;Having the most impossible time breaking down what you have here to steps we can take because you're so much smarter than me and assume I know things I don't. &amp;nbsp;I hope your enjoying your ambrosia.&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#1842466</link><pubDate>Fri, 09 Mar 2007 10:25:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1842466</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi Chris,&lt;/p&gt;
&lt;p&gt;It's a bit hard to tell just from that description what is going on, but it does sound like one of 2 things if GC 0,1 and 2 increase by pretty much exactly the same numbers.&lt;/p&gt;
&lt;p&gt;1. you do have some large objects that you are perhaps not aware of &lt;/p&gt;
&lt;p&gt;2. someone is calling GC collect&lt;/p&gt;
&lt;p&gt;I would suggest that you check out the large object heap size in perfmon (under .net clr memory) and see if it goes up, if it does, look at the dump and run !dumpheap -min 85000, &amp;nbsp;perhaps all these small objects are stored in a large object array or similar that ends up on the LOH. &lt;/p&gt;
&lt;p&gt;The other option with the GC.Collect you can verify or disspell by checking out the number of induced gc's (also under .net clr memory). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Having said this, GC perf issues like this are super tricky to figure out. &amp;nbsp;I am working on one right now that I was planning on blogging on later (things have just been terribly busy lately), but my issue is caused by something really rare that i dont think applies to your situation. &amp;nbsp;It is caused by a library used in the asp.net app calling SetProcessorAffinityMask limiting the process to run on one process:) and thus causing all the gc threads to spin on that one process in turn causing major cpu usage... &amp;nbsp;a very ugly story... &lt;/p&gt;
</description></item><item><title>High CPU in GC and other badness caused by SetProcessAffinityMask</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#1865698</link><pubDate>Mon, 12 Mar 2007 18:31:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1865698</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;I thought I'd share a support story with you from a very interesting case I have. My customer is running&lt;/p&gt;
</description></item><item><title>  ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState at  Sanal Kiler</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#2146803</link><pubDate>Sun, 15 Apr 2007 23:09:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2146803</guid><dc:creator>  ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState at  Sanal Kiler</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://sanal.org/?p=319"&gt;http://sanal.org/?p=319&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Top 20 .NET Garbage Collection (GC) Articles</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#3453186</link><pubDate>Fri, 22 Jun 2007 08:36:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3453186</guid><dc:creator>roy ashbrook</dc:creator><description>&lt;p&gt;Ah. Garbage Collection... how I love and hate thee. =P I think one sad thing about programming in .net&lt;/p&gt;
</description></item><item><title>Top 10 WinDbg.exe Usage Articles</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#3542095</link><pubDate>Tue, 26 Jun 2007 12:49:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3542095</guid><dc:creator>roy ashbrook</dc:creator><description>&lt;p&gt;These are the articles (in no particular order) that I felt best showed a thorough use of the WinDbg&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates</title><link>http://blogs.msdn.com/tess/archive/2006/06/22/asp-net-case-study-high-cpu-in-gc-large-objects-and-high-allocation-rates.aspx#9646553</link><pubDate>Thu, 28 May 2009 12:05:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9646553</guid><dc:creator>Webmaster</dc:creator><description>&lt;p&gt;Thanks, this really helped me find one of the problems leading to high cpu usage on our server!&lt;/p&gt;</description></item></channel></rss>