<?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>Alik Levin's : Performance</title><link>http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx</link><description>Tags: Performance</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Architects UG: 16 Case Studies of ASP.NET Web Performance</title><link>http://blogs.msdn.com/alikl/archive/2009/06/23/architects-ug-16-case-studies-of-asp-net-web-performance.aspx</link><pubDate>Tue, 23 Jun 2009 22:38:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9800095</guid><dc:creator>alikl</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9800095.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9800095</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9800095</wfw:comment><description>&lt;p&gt;&lt;a href="http://practicethis.com/" rel="external nofollow" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; Below is a slide deck for the talk I gave today on Architect UG. The presentation focused on 16 case studies of performance that is less than optimal. The session is focused on baking performance engineering into the development lifecycle.&lt;/p&gt;  &lt;p&gt;Each case study has a link to the detailed walkthrough and relevant resources on how to improve performance.&lt;/p&gt;  &lt;p&gt;Enjoy&lt;/p&gt; &lt;iframe style="border-bottom: #dde5e9 1px solid; border-left: #dde5e9 1px solid; padding-bottom: 0px; background-color: #ffffff; margin: 3px; padding-left: 0px; width: 240px; padding-right: 0px; height: 66px; border-top: #dde5e9 1px solid; border-right: #dde5e9 1px solid; padding-top: 0px" marginheight="0" src="http://cid-dd25b83e4ca261f7.skydrive.live.com/embedrowdetail.aspx/Blog%20Bucket/Performance/Arch%20UG%20-%20Performance%20Arch%20-%20V7.pdf" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9800095" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Architecture/default.aspx">Architecture</category></item><item><title>Free Web Performance Tools From Microsoft, Google, Yahoo, And IBM</title><link>http://blogs.msdn.com/alikl/archive/2009/06/11/free-web-performance-tools-from-microsoft-google-yahoo-and-ibm.aspx</link><pubDate>Thu, 11 Jun 2009 11:56:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9726219</guid><dc:creator>alikl</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9726219.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9726219</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9726219</wfw:comment><description>&lt;table border="0" cellspacing="5" cellpadding="2" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" rel="external nofollow" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; This post is a quick overview of free performance tools available from Microsoft, Yahoo, Google, and IBM. It also contains a pointers to related articles that go deeper regarding the best practices and how the tools can help in identifying compliance to the best practices.&lt;/td&gt;        &lt;td valign="top" width="314"&gt;         &lt;p&gt;&lt;strong&gt;Quick Resource Box:&lt;/strong&gt;&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;Microsoft’s &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt; (&lt;a href="http://www.fiddler2.com/redir/?id=HTTPPERF"&gt;Performance Tuning with Fiddler&lt;/a&gt;)&lt;/li&gt;            &lt;li&gt;Microsoft’s &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=119f3477-dced-41e3-a0e7-d8b5cae893a3&amp;amp;displaylang=en"&gt;VRTA&lt;/a&gt; (&lt;a href="http://msdn.microsoft.com/en-us/magazine/dd188562.aspx"&gt;12 Steps To Faster Web Pages With Visual Round Trip Analyzer&lt;/a&gt;)&lt;/li&gt;            &lt;li&gt;Yahoo’s &lt;a href="http://developer.yahoo.com/yslow/"&gt;YSlow&lt;/a&gt; (&lt;a href="http://developer.yahoo.com/performance/rules.html"&gt;rules for high performance web pages&lt;/a&gt;.)&lt;/li&gt;            &lt;li&gt;IBM’s &lt;a href="http://www.alphaworks.ibm.com/tech/pagedetailer/download"&gt;Page Detailer&lt;/a&gt;&lt;/li&gt;            &lt;li&gt;Google’s &lt;a href="http://code.google.com/speed/page-speed/"&gt;Page Speed&lt;/a&gt; (&lt;a href="http://code.google.com/speed/page-speed/docs/rules_intro.html"&gt;Web Performance Best Practices&lt;/a&gt;)&lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td colspan="2"&gt;         &lt;h3&gt;Microsoft’s Fiddler&lt;/h3&gt;          &lt;p&gt;&lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt; is a free web performance tool, it is not really a property of Microsoft rather a side project by &lt;a href="http://en.wikipedia.org/wiki/Fiddler_(software)"&gt;Eric Lawrence&lt;/a&gt;, a PM with Microsoft. I used Fiddler for both security testing and now for performance. I love it a lot. Must mention it requires Net Fx 2.0 as a prerequisite so it is limited to Windows OS. Recently Eric added support to Firefox – &lt;a href="http://www.fiddler2.com/fiddler2/addons/fiddlerhook/"&gt;Fiddler Hook For Firefox&lt;/a&gt;, so the tool is great for both IE and FF. My related posts:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/10/17/improve-web-application-performance-by-reducing-number-of-http-requests-fiddler-to-the-rescue.aspx"&gt;Improve Web Application Performance By Reducing Number Of Http Requests - Fiddler To The Rescue&lt;/a&gt;&lt;/li&gt;            &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/05/02/asp-net-performance-sin-serving-images-dynamically-or-another-reason-to-love-fiddler.aspx"&gt;ASP.NET Performance Sin - Serving Images Dynamically (Or Another Reason To Love Fiddler)&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;          &lt;h3&gt;Microsoft’s VRTA&lt;/h3&gt;          &lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=119f3477-dced-41e3-a0e7-d8b5cae893a3&amp;amp;displaylang=en"&gt;VRTA&lt;/a&gt; is a free web performance tool and it stands for Visual Round Trip Analyzer created by Microsoft’s Jim Pierson and used internally for sometime. It was made available for public use during last PDC 2008. Jim has written very detailed article about the tool and how it solves performance problems - &lt;a href="http://msdn.microsoft.com/en-us/magazine/dd188562.aspx"&gt;12 Steps To Faster Web Pages With Visual Round Trip Analyzer&lt;/a&gt;. VRTA installs and uses under the hood free Microsoft Network Monitor (&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=983b941d-06cb-4658-b7f6-3088333d062f&amp;amp;displaylang=en"&gt;Netmon&lt;/a&gt;) to capture and analyze network captures.&lt;/p&gt;          &lt;h3&gt;Yahoo’s YSlow&lt;/h3&gt;          &lt;p&gt;YSlow is a free performance analysis tool created by &lt;a href="http://www.stevesouders.com/"&gt;Steve Souders&lt;/a&gt; when he was with Yahoo. Steve created another good tool called &lt;a href="http://stevesouders.com/cuzillion/"&gt;Cuzilion&lt;/a&gt;. YSlowl comes with extremely good set of performance guidance that can be found here - &lt;a href="http://developer.yahoo.com/performance/rules.html"&gt;rules for high performance web pages&lt;/a&gt;. YSlow requires Firebug as a prerequisite, meaning it is restricted to Firefox only.&lt;/p&gt;          &lt;h3&gt;IBM’s Page Detailer&lt;/h3&gt;          &lt;p&gt;&lt;a href="http://www.alphaworks.ibm.com/tech/pagedetailer/download"&gt;Page Detailer&lt;/a&gt; is a free web performance tool from IBM. I was not able to identify any good articles that cover it – if you share with me please, or better off publish one. It does not have any prerequisites, consider it as an advantage.&lt;/p&gt;          &lt;h3&gt;Google’s Page Speed&lt;/h3&gt;          &lt;p&gt;Recently I stumbled on &lt;a href="http://code.google.com/speed/page-speed/"&gt;Page Speed&lt;/a&gt; from Google. It reminds me a Yahoo’s YSlow lot&amp;#160; that makes me believe it comes from Steve Souders that works now for Google. It also requires Firebug as a prerequisite and works with FireFox only. It comes with nice guidance found here - &lt;a href="http://code.google.com/speed/page-speed/docs/rules_intro.html"&gt;Web Performance Best Practices&lt;/a&gt;. Must admit – I adore the concept of the tool although in most cases I cannot use it as I work for customers that IE is their target browser. Nevertheless the guidance is tool agnostic and I recommend bookmarking it for quick reference.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9726219" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Tools/default.aspx">Tools</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Distributed Architecture Drawbacks Revealed By Netmon(Bonus - TDS Parser Goes Public)</title><link>http://blogs.msdn.com/alikl/archive/2009/03/13/distributed-architecture-drawbacks-revealed-by-netmon-bonus-tds-parser-goes-public.aspx</link><pubDate>Fri, 13 Mar 2009 12:02:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9472886</guid><dc:creator>alikl</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9472886.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9472886</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9472886</wfw:comment><description>&lt;table border="0" cellspacing="5" cellpadding="2" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" rel="external nofollow" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; Distributed architecture can mercilessly backfire at you.&amp;#160; In my case flexible architecture, elegant design patterns, and smart code led to abuse of the flexibility, resulting in &lt;strong&gt;&lt;em&gt;very poor performance&lt;/em&gt;&lt;/strong&gt;. Free &lt;a href="http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=f4db40af-1e08-4a21-a26b-ec2f4dc4190d&amp;amp;displaylang=en"&gt;Microsoft Network Monitor (Netmon)&lt;/a&gt; helped to identify the root cause of the &lt;/td&gt;        &lt;td valign="top" width="314"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="Distributed Architecture Hits Bac" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/NetmonHelpsRevealingDistributedArchitect_794A/image_3.png" width="244" height="184" /&gt;           &lt;br /&gt;&lt;em&gt;&lt;font size="1"&gt;by &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.flickr.com/photos/striatic/"&gt;&lt;b&gt;&lt;em&gt;&lt;font size="1"&gt;striatic&lt;/font&gt;&lt;/em&gt;&lt;/b&gt;&lt;/a&gt;&amp;#160; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td colspan="2"&gt;performance hit. It showed that over-distributed-ness can cost you in terms of performance.          &lt;h3&gt;Customer Case Study&lt;/h3&gt;          &lt;p&gt;The customer complained about poor response times in his web application. The application's architecture was similar to the &lt;a href="http://apparch.codeplex.com/Wiki/View.aspx?title=Web%20Application%20Archetype&amp;amp;referringTitle=Application%20Types%20(Archetypes)"&gt;Web Application Archetype&lt;/a&gt;. Notice Services Agent box that connects your application to downstream services? Our assumption was that the services agents are too chatty causing the performance hit. Netmon only made it clear.&lt;/p&gt;          &lt;h3&gt;Analysis&lt;/h3&gt;          &lt;p&gt;We took captures on the application server where the Server Agents are to identify what other downstream servers are accessed. In no time we get very clear picture - the application server was accessing other three downstream resources:&lt;/p&gt;          &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/NetmonHelpsRevealingDistributedArchitect_794A/image_8.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="netmon distributed architecture" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/NetmonHelpsRevealingDistributedArchitect_794A/image_thumb_2.png" width="384" height="217" /&gt;&lt;/a&gt; &lt;/p&gt;          &lt;p&gt;There are two well known ports - 443 and 1433 - so we could safely assume there is communication over SSL/HTTPS and SQL Server. The other one - 1414 - turned out to be MQ.&lt;/p&gt;          &lt;p&gt;Next step was to identify which one of the conversations is causing us troubles the most - either by chatty communication or by just long running transaction.&lt;/p&gt;          &lt;p&gt;Looking at Time Delta column for HTTPS stateless communications we found nothing exciting regarding the latency:&lt;/p&gt;          &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="HTTPS Communications network monitor" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/NetmonHelpsRevealingDistributedArchitect_794A/image_11.png" width="564" height="142" /&gt; &lt;/p&gt;          &lt;p&gt;For MQ communications we used magic ContainsBin(FrameData, 0,&amp;quot;StringToFindGoesHere&amp;quot;) to identify XML messages going back and forth over MQ transport. For example, to find the beginning of the XML message we used the following filter:&lt;/p&gt;          &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="Netmon ContainsBin" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/NetmonHelpsRevealingDistributedArchitect_794A/image_14.png" width="565" height="228" /&gt;&lt;/p&gt;          &lt;p&gt;Similar technique was used to correlate request and response XML messages.&lt;/p&gt;          &lt;p&gt;To identify SQL communication we used shiny new TDS parser available for free download on Codeplex - &lt;a href="http://blogs.technet.com/netmon/archive/2009/02/27/sql-parser-in-latest-codeplex-package.aspx"&gt;SQL Parser in Latest CodePlex Package&lt;/a&gt;. I particularly like this one, it shows SQL Server communication without using SQL Server Profiler:&lt;/p&gt;          &lt;p&gt;&amp;#160;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="netmon tds parser" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/NetmonHelpsRevealingDistributedArchitect_794A/image_17.png" width="508" height="356" /&gt; &lt;/p&gt;          &lt;h3&gt;Conclusion&lt;/h3&gt;          &lt;p&gt;Lessons learned:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;Distributed Architecture can mercilessly backfire at you by its distributed-ness. Use Distributed architecture to solve problems vs introducing new ones.&lt;/li&gt;            &lt;li&gt;Elegant and flexible design can be abused resulting in poor performance. Review code to avoid the abuse.&lt;/li&gt;            &lt;li&gt;Low level network monitoring tools such as Netmon can quickly reveal over-distributed-ness. Use it! It is free.&lt;/li&gt;         &lt;/ul&gt;          &lt;h3&gt;Related Materials&lt;/h3&gt;          &lt;ul&gt;           &lt;li&gt;&lt;a href="http://blogs.msdn.com/ace_team/archive/2008/02/14/do-you-really-need-a-distributed-architecture.aspx"&gt;Do You Really Need A Distributed Architecture?&lt;/a&gt; &lt;/li&gt;            &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/05/05/asp-net-performance-engineering-stress-test-your-architecture-design-and-code.aspx"&gt;ASP.NET Performance Engineering - Stress Test Your Architecture, Design, And Code&lt;/a&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9472886" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Architecture/default.aspx">Architecture</category></item><item><title>WinDBG Walkthrough - Dump Values Of DataSet or DataTable</title><link>http://blogs.msdn.com/alikl/archive/2009/03/09/windbg-walkthrough-dump-values-of-dataset-or-datatable.aspx</link><pubDate>Mon, 09 Mar 2009 09:44:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9465219</guid><dc:creator>alikl</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9465219.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9465219</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9465219</wfw:comment><description>&lt;table border="0" cellspacing="5" cellpadding="2" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" rel="external nofollow" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; This walkthrough is completely based on Johan's post &lt;a href="http://labs.episerver.com/en/Blogs/Johano/Dates/2008/3/WinDBGSOS-Getting-at-the-values-in-a-DataTable/"&gt;WinDBG+SOS: Getting at the values in a DataTable&lt;/a&gt;. I have created this one to help me do the job in straightforward way next time I hit similar problem. Joan also offers few scripts for process automation - recommended.&lt;/td&gt;        &lt;td valign="top" width="314"&gt;         &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/af4451f2cf78_7D24/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/af4451f2cf78_7D24/image_thumb.png" width="244" height="188" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;em&gt;&lt;font size="1"&gt;by &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.flickr.com/photos/glennharper/"&gt;&lt;b&gt;&lt;em&gt;&lt;font size="1"&gt;glennharper&lt;/font&gt;&lt;/em&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Customer Case Study&lt;/h3&gt;  &lt;p&gt;The customer complained about potential memory leak. Following the procedure described in &lt;a href="http://blogs.msdn.com/alikl/archive/2009/02/15/identifying-memory-leak-with-process-explorer-and-windbg.aspx"&gt;Identifying Memory Leak With Process Explorer And Windbg&lt;/a&gt; we realized that we are dealing with static variable that grows in unlimited way. This assumption is based on the fact that after running !gcroot on the leaking type we get the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&lt;b&gt;HANDLE(Strong):&lt;/b&gt;&lt;/em&gt;&lt;em&gt;23b1cd0:Root:0x12571730.....&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;After reviewing Tess' &lt;a href="http://blogs.msdn.com/tess/archive/2008/04/03/net-debugging-demos-lab-7-memory-leak-review.aspx"&gt;.NET Debugging Demos Lab 7: Memory Leak - Review&lt;/a&gt; we found the following which made us believe we are dealing with static variable:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;DOMAIN(001CCE68):HANDLE(Strong) - Strong reference, Typically a static variable&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;To identify what this static variable is we needed to dump its values. The variable was a DataTable. I have not found a straightforward way of dumping contents of DataTable. This is the walkthrough that does the job.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Summary of steps&lt;/strong&gt;&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Step 1. Dump DataTables&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 2. Dump DataTable&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 3. Dump columnCollection&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 4. Dump list object&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 5. Dump raw memory - dd command&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 6. Dump DataColumn&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 7. Dump storage&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 8. Dump values&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 9. Bonus - automation&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;strong&gt;Step 1. Dump DataTables&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identify all DataTable object and pick the one of the interest&lt;/p&gt;  &lt;p&gt;0:000&amp;gt; !dumpdatatables    &lt;br /&gt;DataTable&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Rows&amp;#160;&amp;#160;&amp;#160; Columns&amp;#160;&amp;#160;&amp;#160; DataSet nextRowID ColumnCount     &lt;br /&gt;-----------------------------------------------------------------------------------------------     &lt;br /&gt;0x024dc948 0x024dcbc8 0x024dcdec 0x064f2400&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2     &lt;br /&gt;0x025156b8 0x02515938 0x02515b5c 0x02515478&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 7     &lt;br /&gt;...&lt;/p&gt;  &lt;p&gt;0x0e5b9ce4 0x0e5b9f64 0x0e5ba138 0x0e55a338&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 428&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5    &lt;br /&gt;0x06510e54 0x065110d4 0x065112a8 0x064f2400&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1,359&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 7     &lt;br /&gt;0x0e5778f0 0x0e577b70 0x0e577d44 0x0e55a338&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1,359&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 7     &lt;br /&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55d270&lt;/font&gt;&lt;/strong&gt; 0x0a55d4f0 0x0a55d6c4 0x06a62620 &lt;strong&gt;&lt;font color="#ff0000"&gt;4,194,305&lt;/font&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 10     &lt;br /&gt;Total 61 DataTable objects&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 2. Dump DataTable&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identifying the address of columnCollection of the DataTable.&lt;/p&gt;  &lt;p&gt;0:000&amp;gt; !do &lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55d270&lt;/font&gt;       &lt;br /&gt;&lt;/strong&gt;Name: System.Data.DataTable     &lt;br /&gt;...     &lt;br /&gt;0x176c1560 0x40003f2&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0x18&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CLASS&amp;#160;&amp;#160; instance &lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55d6c4&lt;/font&gt;&lt;/strong&gt; columnCollection     &lt;br /&gt;...&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 3. Dump columnCollection&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identifying&amp;#160; the address of &lt;strong&gt;&lt;em&gt;list&lt;/em&gt;&lt;/strong&gt; object of the columnCollection.&lt;/p&gt;  &lt;p&gt;0:000&amp;gt; !do &lt;font color="#ff0000"&gt;&lt;strong&gt;0x0a55d6c4&lt;/strong&gt;&lt;/font&gt;     &lt;br /&gt;Name: System.Data.DataColumnCollection     &lt;br /&gt;...     &lt;br /&gt;0x176c5ffc 0x4000377&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0x8&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CLASS&amp;#160;&amp;#160; instance &lt;font color="#ff0000"&gt;&lt;strong&gt;0x0a55d6f8&lt;/strong&gt;&lt;/font&gt; &lt;strong&gt;&lt;em&gt;list&lt;/em&gt;&lt;/strong&gt;     &lt;br /&gt;...&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 4. Dump list object&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identifying the address of &lt;strong&gt;&lt;em&gt;_items&lt;/em&gt;&lt;/strong&gt; object.&lt;/p&gt;  &lt;p&gt;0:000&amp;gt; !do &lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55d6f8&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;Name: System.Collections.ArrayList     &lt;br /&gt;...     &lt;br /&gt;0x79ba75ec 0x4000362&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0x4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CLASS&amp;#160;&amp;#160; instance &lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55d710&lt;/font&gt;&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;_items&lt;/em&gt;&lt;/strong&gt;     &lt;br /&gt;...&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 5. Dump raw memory - dd command&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identifying addresses of DataColumn objects.&lt;/p&gt;  &lt;p&gt;0:000&amp;gt; dd &lt;font color="#ff0000"&gt;&lt;strong&gt;0x0a55d710        &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;0a55d710&amp;#160; 01e5209c 00000010 79b92eec &lt;strong&gt;&lt;font color="#ff0000"&gt;0a55d854        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;0a55d720&amp;#160; 0a55d8d4 0a55d954 0a55d9d4 &lt;strong&gt;&lt;font color="#ff0000"&gt;0a55da54&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;0a55d730&amp;#160; 0a55dad4 0a55db54 0a55dbd4 &lt;strong&gt;&lt;font color="#ff0000"&gt;0a55dd74&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 6. Dump DataColumn&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identifying the address of &lt;strong&gt;&lt;em&gt;storage&lt;/em&gt;&lt;/strong&gt; object.&lt;/p&gt;  &lt;p&gt;!do &lt;strong&gt;&lt;font color="#ff0000"&gt;0a55d854&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;Name: System.Data.DataColumn     &lt;br /&gt;...     &lt;br /&gt;0x176c69e8 0x400036b&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0x48&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CLASS&amp;#160;&amp;#160; instance &lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55df40&lt;/font&gt;&lt;/strong&gt; storage     &lt;br /&gt;...&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 7. Dump storage&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;The objective of this step is identifying address of value object.&lt;/p&gt;  &lt;p&gt;0:000&amp;gt; !do &lt;strong&gt;&lt;font color="#ff0000"&gt;0x0a55df40&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;Name: System.Data.Common.Int32Storage     &lt;br /&gt;...     &lt;br /&gt;0x176ecc8c 0x4000729&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0x10&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CLASS&amp;#160;&amp;#160; instance &lt;strong&gt;&lt;font color="#ff0000"&gt;0x4dbd0030&lt;/font&gt;&lt;/strong&gt; values     &lt;br /&gt;...&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 8. Dump values&lt;/strong&gt; &lt;/h3&gt;  &lt;p&gt;The objective of this step is dumping the actual values, finally... &lt;/p&gt;  &lt;p&gt;0:000&amp;gt; !do &lt;strong&gt;&lt;font color="#ff0000"&gt;0x4dbd0030&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;Name: System.Int32[]     &lt;br /&gt;...     &lt;br /&gt;Content: 8,388,608 items&lt;/p&gt;  &lt;p&gt;Ouch, it is array.... !do -v will dump its values, but I am afraid it is not a good idea doing it for 8 million items here ;)&lt;/p&gt;  &lt;h3&gt;Step 9. Bonus - automation&lt;/h3&gt;  &lt;p&gt;The objective of this step is automate the process of dumping values (Step 8):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create a text file named &lt;strong&gt;&lt;em&gt;dumparray&lt;/em&gt;&lt;/strong&gt; and save it in WinDBG directory. The contents of the file are:       &lt;ul&gt;       &lt;li&gt;.foreach ( o { !do ${$arg1} -v -short }) { !do ${o} } &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Run the following command in WinDBG to dump the values of the array      &lt;ul&gt;       &lt;li&gt;$$&amp;gt;a&amp;lt; dumparray &lt;strong&gt;&lt;font color="#ff0000"&gt;0x4dbd0030&lt;/font&gt;&lt;/strong&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Related Materials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2009/02/15/identifying-memory-leak-with-process-explorer-and-windbg.aspx"&gt;Identifying Memory Leak With Process Explorer And Windbg&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/12/08/avoid-manipulating-passwords-in-memory-it-is-easy-to-reveal.aspx"&gt;Avoid Manipulating Passwords In Memory - It Is Easy To Reveal&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9465219" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Identify And Fix Performance Bottlenecks In ASP.NET Web Applications - Case Studies, Problems, And Solutions</title><link>http://blogs.msdn.com/alikl/archive/2009/03/06/identify-and-fix-performance-bottlenecks-in-asp-net-web-applications-case-studies-problems-and-solutions.aspx</link><pubDate>Sat, 07 Mar 2009 00:16:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9463461</guid><dc:creator>alikl</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9463461.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9463461</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9463461</wfw:comment><description>&lt;table border="0" cellspacing="5" cellpadding="2" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" rel="external nofollow" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; I thought it'd be useful to package the resources referenced in my previous post - &lt;a href="http://blogs.msdn.com/alikl/archive/2009/03/06/why-my-asp-net-application-s-performance-is-less-than-optimal.aspx"&gt;Why My ASP.NET Application's Performance Is Less Than Optimal?&lt;/a&gt;           &lt;br /&gt;I packaged it in form of PDF file. Hope it'll be useful for you when dealing with performance bottlenecks in your ASP.NET web application. &lt;/td&gt;        &lt;td valign="top" width="314"&gt;         &lt;p&gt;&lt;strong&gt;&lt;em&gt;Download &amp;quot;Identifying and Fixing Performance Bottlenecks&amp;quot; PDF file from my &lt;a href="http://dd1mqg.bay.livefilestore.com/y1p1aokyBJotiRgu86cMAtWN3XSOs_DkVM6ZicmGvGiiKXEvbcb_VK6Tyrubdk3I4dw2R4dZ0YwWpI/Identifying%20and%20Fixing%20Performance%20Bottlenecks.pdf?download"&gt;SkyDrive&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;          &lt;p&gt;&amp;#160;&lt;/p&gt;          &lt;p&gt;&lt;iframe style="border-bottom: #dde5e9 1px solid; border-left: #dde5e9 1px solid; padding-bottom: 0px; background-color: #ffffff; margin: 3px; padding-left: 0px; width: 240px; padding-right: 0px; height: 66px; border-top: #dde5e9 1px solid; border-right: #dde5e9 1px solid; padding-top: 0px" marginheight="0" src="http://cid-dd25b83e4ca261f7.skydrive.live.com/embedrowdetail.aspx/Blog%20Bucket/Performance/Identifying%20and%20Fixing%20Performance%20Bottlenecks.pdf" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Feel free to distribute it. If you have suggestions for improvements or just a friendly constructive comment - feel absolutely free to submit one.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;/strong&gt;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;strong&gt;PracticeThis.com&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9463461" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Why My ASP.NET Application's Performance Is Less Than Optimal?</title><link>http://blogs.msdn.com/alikl/archive/2009/03/06/why-my-asp-net-application-s-performance-is-less-than-optimal.aspx</link><pubDate>Fri, 06 Mar 2009 11:01:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9462024</guid><dc:creator>alikl</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9462024.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9462024</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9462024</wfw:comment><description>&lt;table border="0" cellspacing="5" cellpadding="2" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="270"&gt;&amp;#160;&lt;a href="http://practicethis.com/" rel="external nofollow" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; From my recent engagements I collected few performance anti-patterns that make ASP.NET web application to perform the way that is less than optimal. Many related to architecture and design.           &lt;br /&gt;Below is the list of the anti-patterns and related materials on how to identify, analyze, and fix it.           &lt;br /&gt;Have fun - if you feel like sharing your own experiences - that would rock my world!&lt;/td&gt;        &lt;td valign="top" width="270"&gt;         &lt;p&gt;&lt;/p&gt;          &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="ASP.NET Performance not optimal" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/WhyMyASP.NETApplicationIsSlow_8074/image_6.png" width="244" height="184" /&gt; &lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;font size="1"&gt;by &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.flickr.com/photos/striatic/"&gt;&lt;b&gt;&lt;em&gt;&lt;font size="1"&gt;striatic&lt;/font&gt;&lt;/em&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Why My ASP.NET Application Slow?&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Improper HTML Rendering      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/05/02/asp-net-performance-sin-serving-images-dynamically-or-another-reason-to-love-fiddler.aspx"&gt;ASP.NET Performance Sin - Serving Images Dynamically (Or Another Reason To Love Fiddler)&lt;/a&gt; &lt;/li&gt;        &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/10/17/improve-web-application-performance-by-reducing-number-of-http-requests-fiddler-to-the-rescue.aspx"&gt;Improve Web Application Performance By Reducing Number Of Http Requests - Fiddler To The Rescue&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Large data volumes sent over the wire      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/11/02/identify-asp-net-web-services-and-wcf-performance-issues-by-examining-iis-logs.aspx"&gt;Identify ASP.NET, Web Services, And WCF Performance Issues By Examining IIS Logs&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Complex algorithms, casting, serialization costs      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;Best ASP.NET Performance Winner For Data Binding - Hands Up To &lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;Response.Write&lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;()&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Chatty database access      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/04/28/performance-sin-chatty-database-access-and-loops-plus-another-free-performance-tool.aspx"&gt;Performance Sin - Chatty Database Access And Loops (Plus Another Free Performance Tool)&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Session overuse &amp;#8211; blows your RAM causing working process recycles &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2009/02/15/identifying-memory-leak-with-process-explorer-and-windbg.aspx"&gt;Identifying Memory Leak With Process Explorer And Windbg&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Long running operations &amp;#8211; locking on worker threads (threadpool) &lt;/li&gt;    &lt;li&gt;Synchronous communications w/downstream resources (web services, databases)      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/02/improve-asp-net-2-0-performance-with-pageasynctask-multithreading-for-the-masses.aspx"&gt;Improve ASP.NET 2.0 Performance With &lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/02/improve-asp-net-2-0-performance-with-pageasynctask-multithreading-for-the-masses.aspx"&gt;PageAsyncTask&lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/02/improve-asp-net-2-0-performance-with-pageasynctask-multithreading-for-the-masses.aspx"&gt; - Multithreading For The Masses&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Locking files (notice the low CPU in the picture below - this is where the application is locked with teh following excetion)      &lt;ul&gt;       &lt;li&gt;Exception message: The process cannot access the file 'c:\inetpub\wwwroot\webapp\my.log' because it is being used by another process. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="Lcked file in ASP.NET application CPU" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/WhyMyASP.NETApplicationIsSlow_8074/image_3.png" width="521" height="133" /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Serialization      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;Best ASP.NET Performance Winner For Data Binding - Hands Up To &lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;Response.Write&lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;()&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Dynamic compilation      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/08/asp-net-performance-dynamically-loaded-assemblies-cause-application-recycles-problem-and-solution.aspx"&gt;ASP.NET Performance: Dynamically Loaded Assemblies Cause Application Recycles (Problem and Solution)&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;ViewState      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/01/08/how-to-keep-asp-net-viewstate-on-the-server-revised.aspx"&gt;How To Keep ASP.NET &lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/01/08/how-to-keep-asp-net-viewstate-on-the-server-revised.aspx"&gt;ViewState&lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/01/08/how-to-keep-asp-net-viewstate-on-the-server-revised.aspx"&gt; On The Server &amp;#8211; Revised&lt;/a&gt; &lt;/li&gt;        &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/08/16/improve-asp-net-performance-by-disabling-viewstate-and-setting-session-as-readonly.aspx"&gt;Improve ASP.NET Performance By Disabling &lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/08/16/improve-asp-net-performance-by-disabling-viewstate-and-setting-session-as-readonly.aspx"&gt;ViewState&lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/08/16/improve-asp-net-performance-by-disabling-viewstate-and-setting-session-as-readonly.aspx"&gt; And Setting Session As &lt;/a&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/08/16/improve-asp-net-performance-by-disabling-viewstate-and-setting-session-as-readonly.aspx"&gt;ReadOnly&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Chatty resources access      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/04/28/performance-sin-chatty-database-access-and-loops-plus-another-free-performance-tool.aspx"&gt;Performance Sin - Chatty Database Access And Loops (Plus Another Free Performance Tool)&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9462024" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Architecture/default.aspx">Architecture</category></item><item><title>Silverlight - Browser Cache And Performance Optimization</title><link>http://blogs.msdn.com/alikl/archive/2009/02/27/silverlight-browser-cache-and-performance-optimization.aspx</link><pubDate>Fri, 27 Feb 2009 12:23:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9448391</guid><dc:creator>alikl</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9448391.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9448391</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9448391</wfw:comment><description>&lt;table border="0" cellspacing="5" cellpadding="2" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="244"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" border="0" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" height="50" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; I was recently involved in the discussion about how Silverlight application is handled by the browser regarding browser cache. After quick research I have found two great articles by Dino Esposito that contain good explanation of the topic and also offers more caching solutions for improving the performance of pages that host Silverlight application&lt;/td&gt;        &lt;td valign="top" width="296"&gt;         &lt;p&gt;&lt;/p&gt;          &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="Silverlight browser cache" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/SilverlightBrowserCacheAndPerformanceOpt_148D6/image_3.png" width="244" height="191" /&gt; &lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;font size="1"&gt;by &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.flickr.com/photos/emdot/"&gt;&lt;b&gt;&lt;em&gt;&lt;font size="1"&gt;emdot&lt;/font&gt;&lt;/em&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/2009.01.cuttingedge.aspx"&gt;&lt;strong&gt;Managing Dynamic Content Delivery In Silverlight, Part 1&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &amp;#8211; January 2009&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;The XAP package that you get from the Web server has no special meaning to the browser. The browser, therefore, will cache it as it caches anything else it gets from a Web server, adhering to the request cache policies determined by the cache-control and &amp;quot;expires&amp;quot; HTTP header in the request or similar meta tags in the host HTML page.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;A XAP package contains a manifest and one or more assemblies. One of the assemblies contains the entry point of the application; other assemblies are just referenced assemblies. The XAML for the user interface is stored in the resources of the entry point assembly. A XAP package is created by the Visual Studio 2008 extension for Silverlight 2 when you create and build the project.&amp;quot;&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/dd434650.aspx"&gt;&lt;strong&gt;Managing Dynamic Content Delivery In Silverlight, Part 2&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &amp;#8211; February 2009&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;Caching the XAP package doesn't mean caching individual resources such as DLLs, XAML animations, or multimedia content. In the current implementation, resources are extracted from the XAP package every time they are used.&amp;quot;&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Related Materials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/05/02/asp-net-performance-sin-serving-images-dynamically-or-another-reason-to-love-fiddler.aspx"&gt;ASP.NET Performance Sin - Serving Images Dynamically (Or Another Reason To Love Fiddler)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/04/28/performance-sin-chatty-database-access-and-loops-plus-another-free-performance-tool.aspx"&gt;Performance Sin - Chatty Database Access And Loops (Plus Another Free Performance Tool)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9448391" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Architecture/default.aspx">Architecture</category></item><item><title>Use Process Explorer To Quickly Identify Performance Bottlenecks In ASP.NET Web Applications</title><link>http://blogs.msdn.com/alikl/archive/2009/02/17/use-process-explorer-to-quickly-identify-performance-bottlenecks-in-asp-net-web-applications.aspx</link><pubDate>Tue, 17 Feb 2009 21:18:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9428120</guid><dc:creator>alikl</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9428120.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9428120</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9428120</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="300"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx"&gt;Process Explorer&lt;/a&gt; is my best friend when I need to quickly identify potential performance bottlenecks for ASP.NET web applications. When I am called onsite I have it always with me.          &lt;br /&gt;          &lt;br /&gt; It served me well recently so I thought it'd be proper to show my appreciation to the tool and to the &lt;a href="http://blogs.technet.com/markrussinovich/default.aspx"&gt;creator, Mark Russinovich,&lt;/a&gt; by sharing how I use it. Every time I am called onsite to the customer's, first thing I ask to install ...ehm... copy the tool to the server in question. It usually shows hot spots right away and helps making assumptions and decisions.&lt;/td&gt;        &lt;td valign="top" width="240"&gt;         &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="Performance Bottleneck" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/UseProcessExplorerToQ.NETWebApplications_7F8D/image_10.png" width="184" border="0" /&gt;             &lt;br /&gt;&lt;em&gt;&lt;font size="1"&gt;by &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.flickr.com/photos/tacitrequiem/"&gt;&lt;b&gt;&lt;em&gt;&lt;font size="1"&gt;tacit requiem&lt;/font&gt;&lt;/em&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;CPU Usage History&lt;/h3&gt;  &lt;p&gt;This view helps to spot &amp;quot;unusual&amp;quot; activity for ASP.NET Web Application. When I see &amp;quot;too much&amp;quot; red color in this view I start asking question &amp;quot;Why Managed .Net Code performs privileged operations?&amp;quot; From my observations it mostly caused by excessive usage of threading. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="131" alt="CPU Utilization" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/UseProcessExplorerToQ.NETWebApplications_7F8D/image_5.png" width="580" border="0" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/06/20/pitfalls-with-net-multithreading-and-com-objects-threads-must-have-compatible-apartment-models-mta-vs-sta.aspx"&gt;Pitfalls With .Net Multithreading And COM Objects &amp;#8211; Threads Must Have Compatible Apartment Models (MTA vs. STA)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/02/improve-asp-net-2-0-performance-with-pageasynctask-multithreading-for-the-masses.aspx"&gt;Improve ASP.NET 2.0 Performance With PageAsyncTask - Multithreading For The Masses&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Private Bytes Memory&lt;/h3&gt;  &lt;p&gt;This view has become my favorite recently as I was involved in few cases with memory leakage. I think the picture is self explanatory.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="131" alt="Memory Leak" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/UseProcessExplorerToQ.NETWebApplications_7F8D/image_6.png" width="580" border="0" /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2009/02/15/identifying-memory-leak-with-process-explorer-and-windbg.aspx"&gt;Identifying Memory Leak With Process Explorer And Windbg&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;I/O Bytes History&lt;/h3&gt;  &lt;p&gt;This view helps me spotting potential I/O bottlenecks.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="129" alt="Network Utilization" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/UseProcessExplorerToQ.NETWebApplications_7F8D/image_9.png" width="393" border="0" /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/04/28/performance-sin-chatty-database-access-and-loops-plus-another-free-performance-tool.aspx"&gt;Performance Sin - Chatty Database Access And Loops (Plus Another Free Performance Tool)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/05/02/asp-net-performance-sin-serving-images-dynamically-or-another-reason-to-love-fiddler.aspx"&gt;ASP.NET Performance Sin - Serving Images Dynamically (Or Another Reason To Love Fiddler)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9428120" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Identifying Memory Leak With Process Explorer And Windbg</title><link>http://blogs.msdn.com/alikl/archive/2009/02/15/identifying-memory-leak-with-process-explorer-and-windbg.aspx</link><pubDate>Sun, 15 Feb 2009 20:20:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9424564</guid><dc:creator>alikl</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9424564.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9424564</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9424564</wfw:comment><description>&lt;p&gt;&lt;/p&gt;  &lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="337"&gt;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; Your ASP.NET web application behaves strange. It gets stuck, it stop serving incoming requests, or gets recycled. You observe strange &lt;a href="http://support.microsoft.com/kb/332088"&gt;application pool recycles events&lt;/a&gt; in event log.           &lt;br /&gt;Chances you are dealing with memory leak in your ASP.NET web application. Lately I've been involved with few of such situations. Here is the method and the resources that helped me to extremely quickly identify the root cause of the memory leaks. I am super grateful to the resources published by Tess and Rico that discuss the process of memory leak identification in more detail:           &lt;ul&gt;           &lt;li&gt;&lt;a href="http://www.theserverside.net/tt/blogs/showblog.tss?id=TrackingMemoryLeaks"&gt;Tracking Down Managed Memory Leaks&lt;/a&gt; &lt;/li&gt;            &lt;li&gt;&lt;a href="http://blogs.msdn.com/tess/archive/2008/04/03/net-debugging-demos-lab-7-memory-leak-review.aspx"&gt;.NET Debugging Demos Lab 7: Memory Leak - Review&lt;/a&gt; &lt;/li&gt;            &lt;li&gt;&lt;a href="http://blogs.msdn.com/tess/archive/2008/11/21/slides-and-resources-for-teched-presentations-about-debugging-net-issues-with-windbg.aspx"&gt;Slides and resources for TechED presentations about debugging .NET issues with Windbg&lt;/a&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;        &lt;td valign="top" width="203"&gt;         &lt;p&gt;&lt;/p&gt;          &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="244" alt="Memory Leak Process Explorer Windbg" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/IdentifyingMemoryLeakWithProcessExplorer_7F3A/image5.png" width="195" border="0" /&gt; &lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;font size="1"&gt;by &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.flickr.com/photos/sutto007/"&gt;&lt;b&gt;&lt;em&gt;&lt;font size="1"&gt;Sutto's Photography (was mns007)&lt;/font&gt;&lt;/em&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Customer Case Study&lt;/h3&gt;  &lt;p&gt;The customer complained his application gets less responsive as more subsequent request come in. The customer reported the high CPU utilization. At some point the application gets stuck and the only way to get it back is..... iisreset. The customer felt there is a memory leak in the application.&lt;/p&gt;  &lt;h3&gt;Analysis - &lt;strong&gt;Summary of steps&lt;/strong&gt;&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Step 1 - Use Process Explorer To Confirm The Memory Leak&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 2 - Take Memory Dump Using adplus.vbs&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 3 - Use Windbg to identify the leaking Type&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 4 - Use Windbg to identify to identify who's holding on the Type&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Step 5 - Find the culprit in the source code&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Step 1 - Use Process Explorer To Confirm The Memory Leak &lt;/h3&gt;  &lt;p&gt;I am using &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx"&gt;Process Explorer&lt;/a&gt; to quickly identify whether we are dealing with memory leak. In our case it showed we are. This is the memory consumption that Process Explorer reveals in very convincing way - you can clearly see how the memory consumption climbs up until the application hangs/restarts:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="123" alt="Porcess Explorer Memory Leak" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/IdentifyingMemoryLeakWithProcessExplorer_7F3A/image_3.png" width="553" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;Next question is who's consuming the memory? Windbg to the rescue.&lt;/p&gt;  &lt;h3&gt;Step 2 - Take Memory Dump Using adplus.vbs &lt;/h3&gt;  &lt;p&gt;Use &lt;a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx"&gt;Windows Debugging Tools&lt;/a&gt; package to take a memory dump of the leaking managed process. Download the tools and extract on the server where the application runs. Open command prompt and change the directory to the folder that contains the tools, then type the following command:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;adplus.vbs -quiet -hang -p &amp;lt;&amp;lt;PROCESSID&amp;gt;&amp;gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;where &amp;lt;&amp;lt;PROCESSID&amp;gt;&amp;gt; is the process of w3wp.exe PID (process ID) that runs the leaking application. The result should be another folder inside of tools folder with very lengthy name. Open that folder- you should see a big size file with DMP extension. This is the memory dump you have just taken.&lt;/p&gt;  &lt;h3&gt;Step 3 - Use Windbg to identify the leaking Type &lt;/h3&gt;  &lt;p&gt;To analyze the dump file you will going to use Windbg.exe. The tool is located in the Debugging Tools for Windows folder, same folder that contains adplus.vbs that was used in the previous exercise. Open the tool, Windbg.exe. Press Ctrl+D, locate your DMP file and open it.&lt;/p&gt;  &lt;p&gt;Now you need to load SOS.DLL extension to analyze managed memory dump. Type the following command according ro what .Net framework you are analyzing:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;.load clr10\sos - for Net 1.X&lt;/p&gt;    &lt;p&gt;.loadby sos mscorwks.dll - for Net 2.0 and up.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Type the following command to identify the Type that consumes most of the memory:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;!dumpheap -stat&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The result should be similar to the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;.....      &lt;br /&gt;654088b4 92811 13736028 System.Data.DataColumn       &lt;br /&gt;000dec48 44 13900264 Free       &lt;br /&gt;654359c8 31704 32845344 System.Data.RBTree`1+Node[[System.Int32, mscorlib]][]       &lt;br /&gt;7912d8f8 320769 47859900 System.Object[]       &lt;br /&gt;790fd8c4 827939 &lt;b&gt;&lt;font color="#ff0000"&gt;186834312&lt;/font&gt;&lt;/b&gt; System.String&lt;/p&gt;    &lt;p&gt;Total 3351270 objects&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Most consuming is that System.String type that is responsible for almost 190 MB of allocated memory.&lt;/p&gt;  &lt;h3&gt;Step 4 - Use Windbg to identify to identify who's holding on the Type &lt;/h3&gt;  &lt;p&gt;Next question your should ask is who's holding on it so that it's not collected. For that purpose type the following command in Windbg but be prepared to hit Ctrl+Break to stop it as you do not want to list all 827939 strings, you are looking for a few to get its addresses:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;!dumpheap -type System.String&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The output should be similar to this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;057f9364 790fd8c4 4116      &lt;br /&gt;057fa4b8 790fd8c4 4116       &lt;br /&gt;057fb52c 790fd8c4 4116       &lt;br /&gt;057fc68c 790fd8c4 4116       &lt;br /&gt;057fd700 790fd8c4 4116       &lt;br /&gt;0583fef8 790fd8c4 4116&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Next you want to start trying to identify who's holding on the objects. That can be done using the following command (I replaced the real Namespaces with XXXXXXXX to keep customer's privacy):&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;0:000&amp;gt; !gcroot 0583fef8      &lt;br /&gt;Note: Roots found on stacks may be false positives. Run &amp;quot;!help gcroot&amp;quot; for       &lt;br /&gt;more info.       &lt;br /&gt;&amp;#8230;       &lt;br /&gt;Scan Thread 27 OSTHread e40       &lt;br /&gt;DOMAIN(00102980):HANDLE(WeakLn):945e00:Root:19312e44(System.Web.Hosting.ISAPIAsyncCompletionCallback)-&amp;gt;       &lt;br /&gt;190c2950(System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6)-&amp;gt;       &lt;br /&gt;190c3138(System.Web.HttpContext)-&amp;gt;       &lt;br /&gt;190c340c(System.Web.AspNetSynchronizationContext)-&amp;gt;       &lt;br /&gt;0cbb80d0(ASP.global_asax)-&amp;gt;       &lt;br /&gt;01b3a5b4(System.Web.&lt;strong&gt;&lt;font color="#ff0000"&gt;HttpApplicationState&lt;/font&gt;&lt;/strong&gt;)-&amp;gt;       &lt;br /&gt;01b3a610(System.Collections.ArrayList)-&amp;gt;       &lt;br /&gt;0a4e4c10(System.Object[])-&amp;gt;       &lt;br /&gt;05846388(System.Collections.Specialized.NameObjectCollectionBase+NameObjectEntry)-&amp;gt;       &lt;br /&gt;058331c8(XXXXXXXX.Web.UI.WebControls.XXXXXXXX.XXXXXXXX)-&amp;gt;       &lt;br /&gt;058333c0(XXXXXXXX.Web.UI.WebControls.XXXXXXXX.Statuses)-&amp;gt;       &lt;br /&gt;058333cc(System.Object[])-&amp;gt;       &lt;br /&gt;0583fe20(XXXXXXXX.Web.UI.WebControls.XXXXXXXX.Status)-&amp;gt;       &lt;br /&gt;0583fee0(System.Object[])-&amp;gt;       &lt;br /&gt;05840f0c(XXXXXXXX.Web.UI.WebControls.XXXXXXXX.Style)-&amp;gt;       &lt;br /&gt;0583fef8(System.String)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Looks like the code using endlessly Application object sticking strings into it. Once there it's never collected until the end of life of the Application which caused only by recycle.&lt;/p&gt;  &lt;h3&gt;Step 5 - Find the culprit in the source code&lt;/h3&gt;  &lt;p&gt;Next is to look in the source code all the usages of assigning strings to Application object. After quick look up we identified the following code that is called recursively:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;HttpApplicationState app&lt;/font&gt;&lt;/strong&gt; = HttpContext.Current.Application;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;for (int i=0; i &amp;lt; m_XXXXXX.Count; i++)       &lt;br /&gt;{       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; string sProcessId = m_XXXXXX[i].SelectSingleNode(&amp;quot;@XXXXXX&amp;quot;).Value;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;&lt;font color="#ff0000"&gt;app&lt;/font&gt;&lt;/strong&gt;.&lt;strong&gt;&lt;font color="#ff0000"&gt;Set&lt;/font&gt;&lt;/strong&gt; (GetPrefix() + XXXXX, new XXXXXX(m_XXXXXX[i].OuterXml));       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;I have been using the following approach several times lately and it has proven to be very effective and efficient. It's simple too.&lt;/p&gt;  &lt;p&gt;Happy memory leak analysis.&lt;/p&gt;  &lt;h3&gt;Related Materials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/12/08/avoid-manipulating-passwords-in-memory-it-is-easy-to-reveal.aspx"&gt;Avoid Manipulating Passwords In Memory - It Is Easy To Reveal&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9424564" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>DebugView - Free Simple Tool To Quickly Identify Performance Problems</title><link>http://blogs.msdn.com/alikl/archive/2008/11/11/debugview-free-simple-tool-to-quickly-identify-performance-problems.aspx</link><pubDate>Tue, 11 Nov 2008 18:12:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9060327</guid><dc:creator>alikl</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9060327.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9060327</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9060327</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;a href="http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx"&gt;DebugView is well known free tool from Systinternals (Microsoft)&lt;/a&gt;. Vast majority of developers is aware of its existence. Nevertheless, I've decided to write this post following my practice of journaling my technical accomplishments during engagements with the customers. Yesterday the tool helped us identify serious performance problem without installing profiler or even taking memory dumps.&lt;/td&gt;        &lt;td valign="top" width="314"&gt;&lt;script type="text/javascript"&gt;
 
&lt;!-- 
lqm_channel=1;
lqm_publisher=253;
lqm_zone=1;
lqm_format=6;
//--&gt;&lt;/script&gt;&lt;script src="http://a.lakequincy.com/s.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Customer Case Study&lt;/h3&gt;  &lt;p&gt;The customer complained about &amp;quot;bad performance&amp;quot; of web pages. The application was pretty simple one - ASP.NET pages accessing SQL Server for simple queries. The SQL Server was installed on the same machine where ASP.NET app resided. The pages took up to ten seconds to render.&lt;/p&gt;  &lt;h3&gt;Analysis&lt;/h3&gt;  &lt;p&gt;After quick code review we found out that the code called function that traversed all server controls using recursion. This function was called several times during the page lifecycle. I presented the team with my assumption that this code is a potential culprit of the &amp;quot;bad performance&amp;quot;. The opposite assumption I faced was &amp;quot;but there is only so few controls on the page, it cannot consume too much time.&amp;quot;&lt;/p&gt;  &lt;p&gt;We decided to add single line of code to the function in question:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;System.Diagnostics.Trace.WriteLine (&amp;quot;Calling Recursive Function&amp;quot;);&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Then we fired up DebugView and ran the page.&lt;/p&gt;  &lt;p&gt;The team was amazed by what DebugView presented interactively. &amp;quot;Calling Recursive Function&amp;quot; line kept piling up on and on. Each call took from 50 to 100 milliseconds but when multiplied to overall number of calls (~700) it gave us clear understanding what caused the performance hit.&lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Instrument your application properly - simple yet powerful technique that helps you avoid calling expensive consultants onsite. &lt;/p&gt;  &lt;p&gt;Instrument your application and surprise your end users by high performing application.&lt;/p&gt;  &lt;h3&gt;Related Materials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/07/16/use-sysinternals-debugview-to-diagnose-the-application.aspx"&gt;Use Sysinternals DebugView To Diagnose The Application&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/11/03/asp-net-performance-by-design-takeaways-from-pdc.aspx"&gt;ASP.NET Performance By Design: Takeaways From PDC&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;This post is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9060327" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Test+Phase/default.aspx">Test Phase</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Development+Phase/default.aspx">Development Phase</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>SQL Server Performance Insights From The Pro</title><link>http://blogs.msdn.com/alikl/archive/2008/11/06/sql-server-performance-insights-from-the-pro.aspx</link><pubDate>Thu, 06 Nov 2008 13:33:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9048253</guid><dc:creator>alikl</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9048253.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9048253</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9048253</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/jimmymay/"&gt;Jimmy May&lt;/a&gt;, my colleague and a good friend, started to blog recently. Jimmy is one of the most accomplished SQL Server Performance professionals. Point your RSS reader to Jimmy's &lt;a href="http://blogs.msdn.com/jimmymay/rss.xml"&gt;RSS feed&lt;/a&gt; and start absorbing SQL Server Performance he readily shares.           &lt;br /&gt;Here are few recent pearls from Jimmy:&lt;/td&gt;        &lt;td valign="top" width="314"&gt;&lt;script type="text/javascript"&gt;

 
&lt;!-- 
lqm_channel=1;
lqm_publisher=253;
lqm_zone=1;
lqm_format=6;
//--&gt;&lt;/script&gt;&lt;script src="http://a.lakequincy.com/s.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/jimmymay/archive/2008/10/15/perfmon-objects-counters-thresholds-utilities-for-sql-server.aspx"&gt;PerfMon Objects, Counters, Thresholds, &amp;amp; Utilities for SQL Server&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/jimmymay/archive/2008/10/30/drum-roll-please-the-debut-of-the-sql-dmv-all-stars-dream-team.aspx"&gt;Drum Roll, Please...The Debut of The SQL DMV All-Stars Dream Team!&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/jimmymay/archive/2008/10/14/disk-partition-alignment-for-sql-server-slide-deck.aspx"&gt;Disk Partition Alignment (Sector Alignment) for SQL Server: Part 1: Slide Deck&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/jimmymay/archive/2008/11/04/disk-partition-alignment-sector-alignment-for-sql-server-part-2-adding-hp-eva-8000-to-veritas-enterprise-administrator-track-alignment-settings-dialog.aspx"&gt;Disk Partition Alignment (Sector Alignment) for SQL Server: Part 2: Adding HP EVA 8000 to Veritas Enterprise Administrator &amp;#8220;Track Alignment Settings&amp;#8221; Dialog&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a onclick="window.location = &amp;#39;http://www.reddit.com/submit?url=&amp;#39; + encodeURIComponent(window.location); return false" href="http://www.reddit.com/submit"&gt;&lt;img alt="submit to reddit" src="http://www.reddit.com/static/spreddit11.gif" border="0" /&gt; &lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;This post made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9048253" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>ASP.NET Performance By Design: Takeaways From PDC</title><link>http://blogs.msdn.com/alikl/archive/2008/11/03/asp-net-performance-by-design-takeaways-from-pdc.aspx</link><pubDate>Mon, 03 Nov 2008 12:06:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9032152</guid><dc:creator>alikl</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9032152.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9032152</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9032152</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; During PDC, there were 5 dedicated sessions for improving performance in .Net titled &amp;quot;Performance By Design&amp;quot;. The presenters are &lt;a href="http://blogs.msdn.com/ricom"&gt;Rico Mariani&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/vancem/"&gt;Vance Morrison&lt;/a&gt;, and Mark Friedman. These guys live and breathe performance. Although I did not make to get to PDC, I was following after what's going on there. Fortunately, Vance published all slides on his blog. These are my takeaways from the slides he published.&lt;/td&gt;        &lt;td valign="top" width="314"&gt;&lt;script type="text/javascript"&gt;


 
&lt;!-- 
lqm_channel=1;
lqm_publisher=253;
lqm_zone=1;
lqm_format=6;
//--&gt;&lt;/script&gt;&lt;script src="http://a.lakequincy.com/s.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/vancem/archive/2008/10/30/slides-for-pdc-2008-talk-performance-by-design-rico-mariani-s-introduction.aspx"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;a href="http://blogs.msdn.com/vancem/archive/2008/10/30/slides-for-pdc-2008-talk-performance-by-design-rico-mariani-s-introduction.aspx"&gt;Performance by Design Intro&lt;/a&gt; &lt;/h3&gt;  &lt;p&gt;&lt;em&gt;By Rico Mariani&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;My favorite is the first slide that sets the expectations - Performance is about Culture:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Part 1 - Teaching Performance Culture &lt;/li&gt;    &lt;li&gt;Part 2 - General Topics about Managed Code &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I am so happy to see it!&amp;#160; There is a perception about performance in the field - it is about tools. There is another perception - &amp;quot;we can fix performance after we build the app&amp;quot;. I've been through few situations where such approach resulted in extra budget to &amp;quot;fix the performance issues&amp;quot;, missed deadlines, and frustrated customers (and stakeholders). Rico says there are very few rules to follow:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Rule #1 - Measure&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Rule #2 - Do your homework&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Rico explains P&lt;strong&gt;&lt;em&gt;erformance Culture&lt;/em&gt;&lt;/strong&gt; very simply but in powerful way:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Budget. &lt;/strong&gt;An exercise to assess the value of a new feature and the cost you&amp;#8217;d be willing to pay:       &lt;ul&gt;       &lt;li&gt;Begin by thinking about how the customer thinks about performance          &lt;ul&gt;           &lt;li&gt;Responsiveness &lt;/li&gt;            &lt;li&gt;Capacity &lt;/li&gt;            &lt;li&gt;Throughput &lt;/li&gt;            &lt;li&gt;Cost of Entry &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;        &lt;li&gt;Identify the resource the customer views as critical to this system &lt;/li&gt;        &lt;li&gt;Choose the level of performance we want to deliver (do we need an &amp;#8220;A+&amp;#8221; or is a &amp;#8220;D&amp;#8221; good enough) &lt;/li&gt;        &lt;li&gt;Convert this into what resource usage needs to be to succeed &lt;/li&gt;        &lt;li&gt;Don&amp;#8217;t think about the code, think about the customer &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Plan. &lt;/strong&gt;Validate your design against the budget, this is a risk assessment       &lt;ul&gt;       &lt;li&gt;You can&amp;#8217;t plan without a budget, so get one &lt;/li&gt;        &lt;li&gt;Use best practices to select candidate algorithms &lt;/li&gt;        &lt;li&gt;Understand their costs in terms of the critical resource &lt;/li&gt;        &lt;li&gt;Identify your dependencies and understand their costs &lt;/li&gt;        &lt;li&gt;Compare these projected costs against the budgets &lt;/li&gt;        &lt;li&gt;If you are close to budget you will need much greater detail in your plans &lt;/li&gt;        &lt;li&gt;Identify verification steps and places to abort if it goes badly &lt;/li&gt;        &lt;li&gt;Proceed when you are comfortable with the risk &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Verify.&lt;/strong&gt; Measure the final results, discard failures without remorse or penalty, don&amp;#8217;t make us live with them       &lt;ul&gt;       &lt;li&gt;The budget and the plan drive verification steps &lt;/li&gt;        &lt;li&gt;Performance that cannot be verified does not exist &lt;/li&gt;        &lt;li&gt;Don&amp;#8217;t be afraid to cancel features that are not meeting their budgets &amp;#8211; we expect to lose some bets &lt;/li&gt;        &lt;li&gt;Don&amp;#8217;t inflict bad performance on the world &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Bottom line - performance is about culture - tools only support it. Performance cost you either way - either you invest in it or not. Manage it as you'd manage any other risk.&lt;/p&gt;  &lt;h4&gt;My Related Posts&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/ace_team/archive/2008/03/11/improve-net-applications-performance-effectively-and-efficiently.aspx"&gt;Improve .Net Applications Performance Effectively And Efficiently&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/06/20/performance-testing-objectives-document-template.aspx"&gt;Performance Testing Objectives Document Template&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/05/05/asp-net-performance-engineering-stress-test-your-architecture-design-and-code.aspx"&gt;ASP.NET Performance Engineering - Stress Test Your Architecture, Design, And Code&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;a href="http://blogs.msdn.com/vancem/archive/2008/10/30/slides-for-pdc-2008-talk-performance-by-design-measuring-cpu-time.aspx"&gt;CPU Optimization for .NET Applications&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;em&gt;By Vance Morrison&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Vance supports Rico's Rule #1 - Measure. He provides several practical options:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Low Tech: System.Diagnostics.Stopwatch &lt;/li&gt;    &lt;li&gt;Medium Tech: &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc507639.aspx"&gt;MeasureIt&lt;/a&gt; (Automates Stopwatch) &lt;/li&gt;    &lt;li&gt;Medium Tech: Use ETW (Event Tracing for Windows) &lt;/li&gt;    &lt;li&gt;Higher Tech: Sample Based Profiling. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Vance admits that ETW (Event Tracing for Windows)&amp;#160; &amp;quot;...is not easy to use End-to-End: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;We are working it &lt;/li&gt;    &lt;li&gt;We will have more offerings in next release &lt;/li&gt;    &lt;li&gt;It is a complete talk just by itself &lt;/li&gt;    &lt;li&gt;If you need logging NOW you CAN use EventProvider, xperf &lt;/li&gt;    &lt;li&gt;If you can wait a year, it will be significantly nicer.&amp;#160; &lt;/li&gt;    &lt;li&gt;If there is interest, we can have an &amp;#8216;Open Space&amp;#8217; discussion&amp;quot; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;My biggest takeaway from this session is that I know unforgivably too little about &lt;a href="http://www.microsoft.com/whdc/system/sysperf/perftools.mspx"&gt;ETW&lt;/a&gt; - need to ramp up myself on it.&lt;/p&gt;  &lt;h4&gt;My Related Posts&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/ace_team/archive/2008/08/11/asp-net-performance-high-cpu-utilization-case-studies-and-solutions.aspx"&gt;ASP.NET Performance: High CPU Utilization Case Studies And Solutions&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;a href="http://blogs.msdn.com/vancem/archive/2008/10/30/slides-for-pdc-2008-talk-performance-by-design-measuring-memory.aspx"&gt;Memory Optimization for .NET Applications&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;em&gt;By Vance Morrison&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;My favorite slide is #14:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;Fixing Memory Issues: Prevention!&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Fixing Memory Issues is HARD      &lt;ul&gt;       &lt;li&gt;Usually a DESIGN problem: Not Pay for Play &lt;/li&gt;        &lt;li&gt;Using every new feature in your app          &lt;br /&gt;XML, LINQ, WPF, WCF, Serialization, Winforms, &amp;#8230; &lt;/li&gt;        &lt;li&gt;Initialize all subsystems at startup &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;GC Memory Are your Data Structures      &lt;ul&gt;       &lt;li&gt;Tend to be designed early &lt;/li&gt;        &lt;li&gt;Hard to change later &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Thus it Pays to Think about Memory Early!&amp;quot; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;What does it mean to think about memory early? The slide deck is packed with explanation about the measurement tools and the theory behind GC. I'd also expect to see few code samples - both patterns and anti-patterns. &lt;a href="http://blogs.msdn.com/ricom/archive/2003/12/04/41281.aspx"&gt;Mid-life crisis&lt;/a&gt; drill down would work for me.&lt;/p&gt;  &lt;h4&gt;My Related Posts&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/08/asp-net-performance-dynamically-loaded-assemblies-cause-application-recycles-problem-and-solution.aspx"&gt;ASP.NET Performance: Dynamically Loaded Assemblies Cause Application Recycles (Problem and Solution)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx"&gt;Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;a href="http://blogs.msdn.com/vancem/archive/2008/10/30/slides-for-pdc-2008-talk-performance-by-design-parrallel-programming.aspx"&gt;Parallelism for .NET Applications&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;em&gt;By Vance Morrison&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The only takeaway (beside good tips) is that Parallel Computing is getting into mainstream. From the field I see more and more demand for multithreaded work, I observe customers buying strong servers but do not utilize it to its capacity while asking to improve performance. I liked the structure of the session, especially &amp;quot;How .Net Can Help...&amp;quot; slides that offer practical tips and implementation suggestions to improve performance by parallelism. &lt;/p&gt;  &lt;h4&gt;My Related Post&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/02/improve-asp-net-2-0-performance-with-pageasynctask-multithreading-for-the-masses.aspx"&gt;Improve ASP.NET 2.0 Performance With PageAsyncTask - Multithreading For The Masses&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/06/20/pitfalls-with-net-multithreading-and-com-objects-threads-must-have-compatible-apartment-models-mta-vs-sta.aspx"&gt;Pitfalls With .Net Multithreading And COM Objects &amp;#8211; Threads Must Have Compatible Apartment Models (MTA vs. STA)&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;a href="http://blogs.msdn.com/vancem/archive/2008/10/30/slides-for-pdc-2008-talk-performance-by-design-asp-net-performance.aspx"&gt;ASP.NET Web Application Performance&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;em&gt;By Mark Friedman&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;This is really huge slide deck - 110 slides... that covers tons of stuff. &lt;/p&gt;  &lt;p&gt;I was looking for unusual stuff. I found it. Turns out &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=119F3477-DCED-41E3-A0E7-D8B5CAE893A3&amp;amp;displaylang=en"&gt;Visual Round Trip Analyzer&lt;/a&gt; (VRTA) was released to the web. The tool was internal for some time and now it is&amp;#160; available for the masses. Good news!&lt;/p&gt;  &lt;p&gt;I also liked the slides about ETW for IIS. Especially the ETW Trace reporting tool , which is Excel ;). One statement made me feel alert - &amp;quot;Caching the same data in multiple places tends to be wasteful&amp;quot;. Not the statement itself rather the relation to &lt;a href="http://msdn.microsoft.com/en-us/data/cc655792.aspx"&gt;Velocity&lt;/a&gt;, which is MS distributed cache mechanism. Need to dig deeper. Overall, the slide deck is packed with very useful and practical recommendations spanning multiple technologies like ASP.NET, AJAX, and WCF.&lt;/p&gt;  &lt;h4&gt;My Related Posts&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/10/29/asp-net-performance-fast-ajax-faster-ajax.aspx"&gt;ASP.NET Performance: Fast AJAX, Faster AJAX&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/02/18/how-to-consume-wcf-using-ajax-without-asp-net.aspx"&gt;How To Consume WCF Using AJAX Without ASP.NET&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/12/31/asp-net-ajax-control-toolkit-basic-sample-for-dynamicpopulate-control.aspx"&gt;ASP.NET AJAX Control Toolkit - Basic Sample For DynamicPopulate Control&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;a onclick="window.location = &amp;#39;http://www.reddit.com/submit?url=&amp;#39; + encodeURIComponent(window.location); return false" href="http://www.reddit.com/submit"&gt;&lt;img alt="submit to reddit" src="http://www.reddit.com/static/spreddit11.gif" border="0" /&gt; &lt;/a&gt;  &lt;p&gt;&lt;strong&gt;This template is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9032152" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Practices/default.aspx">Practices</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Planning+Phase/default.aspx">Planning Phase</category></item><item><title>ASP.NET Performance: Fast AJAX, Faster AJAX</title><link>http://blogs.msdn.com/alikl/archive/2008/10/29/asp-net-performance-fast-ajax-faster-ajax.aspx</link><pubDate>Wed, 29 Oct 2008 00:43:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9021016</guid><dc:creator>alikl</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alikl/comments/9021016.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=9021016</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=9021016</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; AJAX improves significantly both user experience and performance. It can be further improved by using down level capabilities that .Net framework offers. Specifically, consuming Web Services and WCF directly from client script. The best part is that ASP.NET AJAX comes with built in libraries - server and client - that make coding fun while significantly improving the web application's performance.&lt;/td&gt;        &lt;td valign="top" width="314"&gt;&lt;script type="text/javascript"&gt;

 
&lt;!-- 
lqm_channel=1;
lqm_publisher=253;
lqm_zone=1;
lqm_format=6;
//--&gt;&lt;/script&gt;&lt;script src="http://a.lakequincy.com/s.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Customer Case Study&lt;/h3&gt;  &lt;p&gt;The customer was using hand crafted XmlHttp requests from client scripts requesting the data from ASPX pages. While the goal was achieved - the amount of information sent to the server was minimal and the user interface was responsive - the coding was not really fun. Also, since the requests were sent to regular ASPX pages the whole ASPX pipeline was executing unnecessarily utilizing CPU for nothing. The customer did not want to use Update Panel control. Although it boosts coding productivity, it also adds some burden on the network. Network utilization should have been kept to the minimum. &lt;/p&gt;  &lt;h3&gt;Analysis&lt;/h3&gt;  &lt;p&gt;After quick research I found two great resources that directed me to the solution that would satisfy both requirements:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Coding productivity. &lt;/li&gt;    &lt;li&gt;Minimum of data in transit on the wire. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The first one is from Chris Hay&amp;#160; - &lt;a href="http://silverlightuk.blogspot.com/2008/10/remix08-uk-aspnet-front-end-performance.html"&gt;remix08 UK ASP.NET Front End Performance Slides&lt;/a&gt; and the other one is from Jeff Prosise - &lt;a href="http://download.microsoft.com/download/f/2/a/f2a04d97-4472-4d3d-bc5a-ecec0d073f24/03_Power_%20ASP_NET_AJAX_Programming.ppt"&gt;Power ASP.NET AJAX Programming&lt;/a&gt;. They both outline the usage of Script-Callable Web Services. There are three simple steps to follow:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Declare your Web Service as Script-Callable by adding class level attribute:&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;pre class="code"&gt;[System.Web.Script.Services.&lt;span style="color: #2b91af"&gt;ScriptService&lt;/span&gt;]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AJAXCallableWebService &lt;/span&gt;: System.Web.Services.&lt;span style="color: #2b91af"&gt;WebService
&lt;/span&gt;{
    [&lt;span style="color: #2b91af"&gt;WebMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public string &lt;/span&gt;HelloWorld(&lt;span style="color: blue"&gt;string &lt;/span&gt;name)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;quot;Hello, &amp;quot; &lt;/span&gt;+ name;
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Declare service reference inside the ScriptManager:&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ScriptManager &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ScriptManager1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Services&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ServiceReference &lt;/span&gt;&lt;span style="color: red"&gt;InlineScript&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;~/AJAXCallableWebService.asmx&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Services&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ScriptManager&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Call a Web Service from the client script:&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;script &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;javascript&amp;quot;&amp;gt;
function &lt;/span&gt;callAjax()
{
    &lt;span style="color: blue"&gt;var &lt;/span&gt;text = document.getElementById(&lt;span style="color: #a31515"&gt;&amp;quot;Text1&amp;quot;&lt;/span&gt;).value
    
    AJAXCallsWebService.AJAXCallableWebService.HelloWorld(text,onSuccess);
}
&lt;span style="color: blue"&gt;function &lt;/span&gt;onSuccess(result)
{
    document.getElementById(&lt;span style="color: #a31515"&gt;&amp;quot;result&amp;quot;&lt;/span&gt;).innerText = result;
}
&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;result&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;input &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;button&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;button&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;callAjax()&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;input &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Text1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text&amp;quot; /&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h3&gt;Sample Visual Studio Solution&lt;/h3&gt;

&lt;p&gt;Grab the sample solution implemented using Visual Studio 2008 form my SkyDrive &lt;a href="http://cid-dd25b83e4ca261f7.skydrive.live.com/self.aspx/Visual%20Studio%20Projects/AJAXCallsWebService.zip"&gt;here&lt;/a&gt;:&lt;/p&gt;
&lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-dd25b83e4ca261f7.skydrive.live.com/embedrowdetail.aspx/Visual%20Studio%20Projects/AJAXCallsWebService.zip" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;

&lt;h3&gt;Related Materials&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/02/18/how-to-consume-wcf-using-ajax-without-asp-net.aspx"&gt;How To Consume WCF Using AJAX Without ASP.NET&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2007/12/31/asp-net-ajax-control-toolkit-basic-sample-for-dynamicpopulate-control.aspx"&gt;ASP.NET AJAX Control Toolkit - Basic Sample For DynamicPopulate Control&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;a onclick="window.location = &amp;#39;http://www.reddit.com/submit?url=&amp;#39; + encodeURIComponent(window.location); return false" href="http://www.reddit.com/submit"&gt;&lt;img alt="submit to reddit" src="http://www.reddit.com/static/spreddit11.gif" border="0" /&gt; &lt;/a&gt;

&lt;p&gt;&lt;strong&gt;This template is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9021016" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Development+Phase/default.aspx">Development Phase</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Implementation/default.aspx">Implementation</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/AJAX/default.aspx">AJAX</category></item><item><title>ASP.NET Performance: Dynamically Loaded Assemblies Cause Application Recycles (Problem and Solution)</title><link>http://blogs.msdn.com/alikl/archive/2008/10/08/asp-net-performance-dynamically-loaded-assemblies-cause-application-recycles-problem-and-solution.aspx</link><pubDate>Wed, 08 Oct 2008 16:21:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8991289</guid><dc:creator>alikl</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/alikl/comments/8991289.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=8991289</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=8991289</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; In my speak - dynamically loaded assemblies are those assemblies that were compiled during run time dynamically via CodeProvider like CSharpCodeProvider directly or by using types that use this class internally. Assemblies that are loaded dynamically using reflection via Load/LoadFrom method are out of the scope of this post. &lt;/td&gt;        &lt;td valign="top" width="314"&gt;&lt;script type="text/javascript"&gt;
 
&lt;!-- 
lqm_channel=1;
lqm_publisher=253;
lqm_zone=1;
lqm_format=6;
//--&gt;&lt;/script&gt;&lt;script src="http://a.lakequincy.com/s.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Customer Case Study&lt;/h3&gt;  &lt;p&gt;The customer complained on periodic restarts/recycles of the ASP.NET application. We observed relative entries in the Event Log that showed up systematically on timely basis. We also observed memory utilization growth in Task Manager. After reaching 500 MB of memory utilization the application would recycle spawning another w3wp.exe to accept new incoming requests while draining the old w3wp.exe.&lt;/p&gt;  &lt;h3&gt;Analysis&lt;/h3&gt;  &lt;p&gt;After short discussion with the dev team about the design of the application we thought that the memory leak might be caused by improper usage of XmlSerializer that generate dynamic assemblies. Tess published &lt;a href="http://blogs.msdn.com/tess/archive/2008/03/17/net-debugging-demos-lab-6-memory-leak-review.aspx"&gt;fantastic walk through&lt;/a&gt; specifically dedicated to this case. Using either perfmon (.NET CLR Loading\Current Assemblies) or Process Explorer (see pic below)we observed unusual number (thousands) of loaded assemblies (notice Assemblies column). Also, notice the csc.exe in red - this is CSharp compiler that is invoked on each request:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="226" alt="Process Explorer ASP.NET Performance Dynamically Loaded Assemblies" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/image_thumb.png" width="567" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We decided to take a memory dump to deeply investigate the case. Following are the steps that we took while analyzing the dump using WinDBG to identify the root cause:&lt;/p&gt;  &lt;h4&gt;Step 1 - Dumping memory heap to identify object allocated on heap&lt;/h4&gt;  &lt;p&gt;This is the fragment of the long list of objects. Our attention was caught by unusually large number of reflected assemblies.&lt;/p&gt;  &lt;ul&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/ul&gt;  &lt;p&gt;&lt;b&gt;!dumpheap &amp;#8211;stat      &lt;br /&gt;&lt;/b&gt;&lt;b&gt;&lt;font color="#ff0000"&gt;9,019&lt;/font&gt;&lt;/b&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 216,456 System.Reflection.Assembly     &lt;br /&gt;112&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 4,032 System.Xml.Serialization.TempAssembly     &lt;br /&gt;104&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5,408 System.Xml.Serialization.TypeDesc&lt;/p&gt;  &lt;p&gt;After 3 minutes the number of dynamic assemblies is larger by more 350 assemblies (from subsequent dump):&lt;/p&gt;  &lt;p&gt;&lt;b&gt;!dumpheap &amp;#8211;stat      &lt;br /&gt;&lt;/b&gt;&lt;b&gt;&lt;font color="#ff0000"&gt;9,379&lt;/font&gt;&lt;/b&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 225,096 System.Reflection.Assembly     &lt;br /&gt;114&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 4,104 System.Xml.Serialization.TempAssembly     &lt;br /&gt;102&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5,304 System.Xml.Serialization.TypeDesc&lt;/p&gt;  &lt;h4&gt;Step 2 - Dumping appdomains to identify loaded assemblies&lt;/h4&gt;  &lt;p&gt;Another cross check to make sure we are dealing with tons of loaded assemblies.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;!dumpdomain -stat&amp;#160; &lt;br /&gt;&lt;/b&gt;&amp;#160;&amp;#160;&amp;#160; Domain&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Num Assemblies&amp;#160;&amp;#160; Size Assemblies&amp;#160;&amp;#160;&amp;#160; Name     &lt;br /&gt;0x793f15d8&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2,142,208&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System Domain     &lt;br /&gt;0x793f2aa8&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 56&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 16,012,288&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Shared Domain     &lt;br /&gt;0x000ab7d8&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2,498,560&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DefaultDomain     &lt;br /&gt;0x000d3368&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;b&gt;&lt;font color="#ff0000"&gt;9,018&lt;/font&gt;&lt;/b&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 55,447,040&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /LM/W3SV......&lt;/p&gt;  &lt;p&gt;Total 4 Domains, Total Size 76,100,096&lt;/p&gt;  &lt;h4&gt;Step 3 - Dumping all dynamic assemblies&lt;/h4&gt;  &lt;p&gt;How many of the assemblies are dynamic? (dda stands for dumpdynamicassemblies)&lt;/p&gt;  &lt;p&gt;&lt;b&gt;!dda&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;Domain: 0x793f15d8      &lt;br /&gt;-------------------       &lt;br /&gt;Domain: .       &lt;br /&gt;-------------------       &lt;br /&gt;Domain: DefaultDomain       &lt;br /&gt;-------------------       &lt;br /&gt;Domain: /LM/W3SVC/1/ROOT/......       &lt;br /&gt;-------------------       &lt;br /&gt;Assembly: 0x19058818 [RegexAssembly133_0] Dynamic Module: 0x16f4c220 loaded at: 0x0 Size: 0x0((null))       &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;Assembly: 0x19058818 [RegexAssembly133_0] Dynamic Module: 0x190696a0 loaded at: 0x0 Size: 0x0((null))      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;Assembly: 0x19103ee8 [-0g5u8-v] Dynamic Module: 0x1920d6f8 loaded at: 0x19911000 Size: 0xc000((null))      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;Assembly: 0x190c9a40 [cvmmynwf] Dynamic Module: 0x190dc0d0 loaded at: 0x19a71000 Size: 0x4000((null))      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;Assembly: 0x1911bad8 [0ikhy_lx] Dynamic Module: 0x1911aa98 loaded at: 0x19f21000 Size: 0xc00((null))      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;.......      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;Assembly: 0x43199720 [nv1lvdiy] Dynamic Module: 0x431b3190 loaded at: 0x4cf61000 Size: 0xc00((null))      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;Assembly: 0x2d2bf008 [rk6dabem] Dynamic Module: 0x2d2bf258 loaded at: 0x4cf71000 Size: 0xc00((null))      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;--------------------------------------&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Total &lt;font color="#ff0000"&gt;8,911 Dynamic Assemblies&lt;/font&gt;, Total size: 0x1d5b600(30,782,976) bytes.&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;Step 4 - Saving dynamic assembly to physical DLL&lt;/h4&gt;  &lt;p&gt;Save assemblies to the filesystem&lt;/p&gt;  &lt;p&gt;&lt;b&gt;!savemodule 0x2d2bc4c8 C: \0x1c344438.dll&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;a href="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/clip_image002_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="86" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/clip_image002_thumb.jpg" width="490" border="0" /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To save all the assemblies to the file system use the following command: &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;!dda -save C:\MODULES&lt;/strong&gt;&lt;/p&gt;  &lt;h4&gt;Step 5 - Using Reflector to reverse engineer the DLL:&lt;/h4&gt;  &lt;p&gt;Use Reflector to inspect the implementation/source code of the dynamic assemblies.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;a href="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/clip_image001_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="220" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/clip_image001_thumb.jpg" width="403" border="0" /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;Step 6 - Using Reflector to find&amp;#160; ExpressionEvaluator class&lt;/h4&gt;  &lt;p&gt;Try to locate the class in the static assemblies hopefully hitting the code that generates it:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="178" alt="image" src="http://blogs.msdn.com/blogfiles/alikl/WindowsLiveWriter/ASP.NETPerformanceDynamicallyLoadedAssem_928B/image_thumb_1.png" width="529" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h4&gt;Step 7 - Bingo! Each constructor for ExpressionEvaluator invokes compiler&lt;/h4&gt;  &lt;p&gt;ICodeCompiler compiler = new CSharpCodeProvider().CreateCompiler();    &lt;br /&gt;...     &lt;br /&gt;CompilerResults results = compiler.CompileAssemblyFromSource(options, builder.ToString());    &lt;br /&gt;...    &lt;br /&gt;this._Compiled = results.CompiledAssembly.CreateInstance(&amp;quot;NavServices._ExpressionEvaluator&amp;quot;);&lt;/p&gt;  &lt;p&gt;This is actually the code that causes Process Explorer to show csc.exe under w3wp.exe (see red line in the first pic). And this is the code that caused number of loaded assemblies to grow. And this is the code that caused the application restarts.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;h3&gt;Acknowledgements&lt;/h3&gt;  &lt;p&gt;During this investigation the following resources were used. Big THANK-YOU goes to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Tess - &lt;a href="http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx"&gt;.NET Memory Leak: XmlSerializing your way to a Memory Leak&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Tom - &lt;a title="http://blogs.msdn.com/tom/archive/2007/12/05/dynamic-assemblies-and-what-to-do-about-them.aspx" href="http://blogs.msdn.com/tom/archive/2007/12/05/dynamic-assemblies-and-what-to-do-about-them.aspx"&gt;Dynamic Assemblies and what to do about them&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Johan - &lt;a href="http://blogs.msdn.com/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx"&gt;Getting started with windbg - part I&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Cuko - &lt;a href="http://blogs.msdn.com/baleixo/archive/2008/07/18/outofmemory-compiledassembly.aspx"&gt;OutOfMemory &amp;amp; CompiledAssembly&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Related Materials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://blogs.msdn.com/ace_team/archive/2008/08/11/asp-net-performance-high-cpu-utilization-case-studies-and-solutions.aspx" href="http://blogs.msdn.com/ace_team/archive/2008/08/11/asp-net-performance-high-cpu-utilization-case-studies-and-solutions.aspx"&gt;ASP.NET Performance: High CPU Utilization Case Studies And Solutions&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/07/20/use-free-tools-from-iis-resource-kit-to-warm-up-your-asp-net-1-1-application-by-batch-compilation.aspx"&gt;Use FREE Tools From IIS Resource Kit To Warm Up Your ASP.NET 1.1 Application By Batch Compilation&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;This template is made with &lt;a href="http://practicethis.com/" target="_blank"&gt;PracticeThis.com&lt;/a&gt; plugin for Windows Live Writer&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8991289" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Test+Phase/default.aspx">Test Phase</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Implementation/default.aspx">Implementation</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Improve ASP.NET 2.0 Performance With PageAsyncTask - Multithreading For The Masses</title><link>http://blogs.msdn.com/alikl/archive/2008/10/02/improve-asp-net-2-0-performance-with-pageasynctask-multithreading-for-the-masses.aspx</link><pubDate>Thu, 02 Oct 2008 11:31:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8973165</guid><dc:creator>alikl</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alikl/comments/8973165.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alikl/commentrss.aspx?PostID=8973165</wfw:commentRss><wfw:comment>http://blogs.msdn.com/alikl/rsscomments.aspx?PostID=8973165</wfw:comment><description>&lt;table cellspacing="5" cellpadding="2" width="557" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="186"&gt;&amp;#160;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;img title="Alik Levin" height="50" alt="Alik Levin" src="http://blogs.microsoft.co.il/blogs/mcs/WindowsLiveWriter/d20b00ba5cce_FD44/image_5.png" width="50" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; Multithreading is tough. This is what &lt;a href="http://www.wintellect.com/CS/blogs/jrobbins/default.aspx"&gt;John Robbins&lt;/a&gt; says about it in his excellent book &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FDebugging-Microsoft-NET-2-0-Applications%2Fdp%2F0735622027%2F&amp;amp;tag=practhis-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;Debugging Microsoft .NET 2.0 Applications&lt;/a&gt;&lt;img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=practhis-20&amp;amp;l=ur2&amp;amp;o=1" width="1" border="0" /&gt;:           &lt;br /&gt;          &lt;br /&gt;&amp;quot;Don't do it... Make sure there's no other way you can structure your program before you decide to incorporate multithreading into your application... you are easily adding a minimum of an extra month of development and testing to your schedule&amp;quot;. I agree with it completely. But there are times multithreading is unavoidable. Especially when more and more Services popping up in the wild...&lt;/td&gt;        &lt;td valign="top" width="354"&gt;&lt;img height="365" alt="" src="http://i.msdn.microsoft.com/cc163725.fig02(en-us).gif" width="354" /&gt;           &lt;br /&gt;          &lt;br /&gt;From &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163725.aspx"&gt;Asynchronous Pages in ASP.NET 2.0&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Customer Case Study&lt;/h3&gt;  &lt;p&gt;I am working with the customer to improve their ASP.NET 2.0 application performance. The application issues multiple requests to the backend middleware that is exposed as a web service. The application cannot get a hold on the actual proxies rather it is provided with the components that wrap the web services proxies. The application needs to issue concurrent&amp;#160; requests. Serial request would result in serious latency which is unacceptable by end users.&lt;/p&gt;  &lt;h3&gt;Analysis&lt;/h3&gt;  &lt;p&gt;Since we cannot get hold on web services proxies we cannot utilize available asynchronous methods available with it: BeginMyMethod/EndMyMethod and MyMethodAsync/MyMethodCompleted. But we definitely can utilize another option available with ASP.NET 2.0 - registering asynchronous tasks using PageAsyncTask class.&lt;/p&gt;  &lt;p&gt;The following information is based on the following materials:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163725.aspx"&gt;Asynchronous Pages in ASP.NET 2.0&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.pageasynctask.aspx"&gt;PageAsyncTask Class&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;PageAsyncTask Implementation Steps&lt;/h3&gt;  &lt;p&gt;This is the summary of the steps to implement and register PageAsyncTask:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Create a class that contains lengthy operation&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Declare AsyncTaskDelegate&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Add OnBegin, OnEnd, OnTimeout methods to the class&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Mark the calling page as Async=&amp;quot;true&amp;quot;&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Register the PageAsyncTasks in the ASPX page and execute it&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can grab the Visual Studio 2008 project with the implementation from my SkyDrive &lt;a href="http://cid-dd25b83e4ca261f7.skydrive.live.com/self.aspx/Visual%20Studio%20Projects/MultipleCallsSynchronizedViaAsync.zip"&gt;here&lt;/a&gt;:&lt;/p&gt; &lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-dd25b83e4ca261f7.skydrive.live.com/embedrowdetail.aspx/Visual%20Studio%20Projects/MultipleCallsSynchronizedViaAsync.zip" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;  &lt;h3&gt;Related Materials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/alikl/archive/2008/06/23/improve-asp-net-performance-with-multithreading-using-thread-or-threadpool-objects.aspx"&gt;Improve ASP.NET Performance With Multithreading Using Thread Or ThreadPool Objects&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/ace_team/archive/2008/02/14/do-you-really-need-a-distributed-architecture.aspx"&gt;Do You Really Need A Distributed Architecture?&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="1"&gt;This template is made with &lt;/font&gt;&lt;a href="http://practicethis.com/" target="_blank"&gt;&lt;font size="1"&gt;PracticeThis.com&lt;/font&gt;&lt;/a&gt;&lt;font size="1"&gt; plugin for Windows Live Writer&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8973165" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alikl/archive/tags/Development+Phase/default.aspx">Development Phase</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Implementation/default.aspx">Implementation</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/alikl/archive/tags/Threading/default.aspx">Threading</category></item></channel></rss>