﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <channel>
    <title>See Sharp C#</title>
    <description />
    <link>http://www.brucel.ee/sharpblog/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 2.5.0.6</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://www.brucel.ee/sharpblog/opml.axd</blogChannel:blogRoll>
    <dc:creator>Bruce Lee</dc:creator>
    <dc:title>See Sharp C#</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <item>
      <title>On dealing with EC2 Micro's bursting</title>
      <description>&lt;p&gt;My girlfriend recently decided to go on a long trip, taking lots of pictures along the way. Storing them was getting to be a problem, so I figured that hosting them on one of my EC2 instances would be a decent way to go about things. This, in theory works well, in the sense that she can easily push files up, and making a gallery out of those files will be relatively simple.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So I did just that. And the upload went fine, and the gallery creation went fine. For the most part. You see, the software that I'm using to make galleries out of the images creates thumbnails at runtime (caching the results on disk), and with huge folders of images, this becomes quickly taxing on a micro instance, especially in realtime.&lt;/p&gt;
&lt;p&gt;I needed a solution that would let the thumbnails be generated, but at the same time, I needed to be able to not have my micro instance be CPU-throttled all the time during the generation of the thumbnails.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Easy way out? I made a quick C# program that constantly scans the upload folder for any files that haven't been thumbnailed by the gallery web application, and adds work to its queue if it finds new pictures. Between each thumbnail process, the thread sleeps ten seconds before starting on the next thumbnail; if the queue is empty, it'll scan the directory every five minutes. It'd be better if I could make this a service, instead of a program, but for a quick-and-dirty solution, this works just fine.&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/09/15/On-dealing-with-EC2-Micros-bursting.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/09/15/On-dealing-with-EC2-Micros-bursting.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=884f251d-5220-4a39-9121-e9e2071828f6</guid>
      <pubDate>Thu, 15 Sep 2011 21:20:00 -0400</pubDate>
      <category>C#</category>
      <category>EC2</category>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=884f251d-5220-4a39-9121-e9e2071828f6</pingback:target>
      <slash:comments>27</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=884f251d-5220-4a39-9121-e9e2071828f6</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/09/15/On-dealing-with-EC2-Micros-bursting.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=884f251d-5220-4a39-9121-e9e2071828f6</wfw:commentRss>
    </item>
    <item>
      <title>Twilio Transcription</title>
      <description>&lt;p&gt;Today I had some free time to play around with Twilio, and decided to check out the transcription service that is offered. It's relatively simple to work with, you write some 'TwiML' (Twilio XML, essentially) either directly or through one of their helper libraries, and the service records what the user is saying for up to two minutes. After the recording is done, Twilio will transcribe the text (this is not done in realtime) and will post to the TwiML that you specify it to a link to the recording MP3, the transcripted text, and a link to the transcripted text.&lt;/p&gt;
&lt;p&gt;This is pretty neat stuff. I really love the idea. However, there are some kinks they need to work out of the system. One of my attempts, which was along the lines of '&lt;strong&gt;This is another transcription attempt. Hopefully this will be posted to the database. Ending transcription now.&lt;/strong&gt;' was transcribed as '&lt;strong&gt;Mother****er call hopefully this will be able to do that at this point in time&lt;/strong&gt;'. Not exactly what I had in mind (and Twilio helpfully had the full curse text). To be fair, the saved call sounds pretty terrible (it's a 16bit .wav file at 8kHz, not the best and there probably was some artifacting from being on a cellphone) and would have been reasonably difficult for me to interpret if I didn't already know what it was.&lt;/p&gt;
&lt;p&gt;Moral of the story: Check to see how services you interact with deal with curse words. If you're trying to develop a family-friendly or otherwise somewhat professional service, ensure that you have proper filtering in place to deal with potential issues.&lt;/p&gt;
&lt;p&gt;It's a cool service, but you'd have to put some effort into determining how to monetize around it. The transcription service goes for $0.05/minute, and with an additional $0.01/minute charge already in there for the call itself, you'll have to figure out how to pay for the service.&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/09/11/Twilio-Transcription.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/09/11/Twilio-Transcription.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=1e85dff8-f653-4468-ae2c-8c03aba0aa2e</guid>
      <pubDate>Sun, 11 Sep 2011 22:27:00 -0400</pubDate>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=1e85dff8-f653-4468-ae2c-8c03aba0aa2e</pingback:target>
      <slash:comments>38</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=1e85dff8-f653-4468-ae2c-8c03aba0aa2e</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/09/11/Twilio-Transcription.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=1e85dff8-f653-4468-ae2c-8c03aba0aa2e</wfw:commentRss>
    </item>
    <item>
      <title>More Amazon EC2 Bits</title>
      <description>&lt;p&gt;Amazon recently sent me an alert regarding a worm that's going around, called &lt;a title="Morton information" href="http://www.f-secure.com/v-descs/worm_w32_morto_a.shtml" target="_blank"&gt;Morto&lt;/a&gt;. The worm basically works by attempting to connect to the default Remote Desktop port (3389), and then attempts a few simple username/password combinations to login. If successful, your machine will need to be cleaned.&lt;/p&gt;
&lt;p&gt;I was a bit worried, because I realized my EC2 instance was still running Remote Desktop against the default port. I changed it, and updated the EC2 security group settings to allow inbound traffic to the newly selected port, disconnected, and rebooted (to make the security group settings come into effect).&lt;/p&gt;
&lt;p&gt;Only after I rebooted did I remember that there was yet another firewall that I forgot to configure, the Windows firewall. I was completely locked out of my machine.&lt;/p&gt;
&lt;p&gt;Doing a bit of searching on the net revealed a few other people that had run into the same issue. The list of steps that you should follow is thus:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Shut down the instance that you need to restore access to&lt;/li&gt;
&lt;li&gt;Detach the volume that is attached to root&lt;/li&gt;
&lt;li&gt;Create a new instance (&lt;strong&gt;in the same zone as the first instance&lt;/strong&gt;, otherwise the new instance cannot attach the volume)&lt;/li&gt;
&lt;li&gt;Attach the detached volume to the new instance&lt;/li&gt;
&lt;li&gt;Get into the new instance, &lt;a href="http://www.youtube.com/watch?v=T7JWBbQyi_4" target="_blank"&gt;set the detached volume to 'Online'&lt;/a&gt; within Windows&lt;/li&gt;
&lt;li&gt;Use &lt;a href="http://4sysops.com/archives/regedit-as-offline-registry-editor/" target="_blank"&gt;Regedit in offline mode&lt;/a&gt; to edit the &lt;a href="https://forums.aws.amazon.com/message.jspa?messageID=163161" target="_blank"&gt;registry values associated with the Firewall&lt;/a&gt; (make sure to get Domain, Private, and Public on all ControlSets), ensure that you unload the hive after completion to save the registry.&lt;/li&gt;
&lt;li&gt;Turn the drive to 'Offline' within Windows&lt;/li&gt;
&lt;li&gt;Shutdown the new instance&lt;/li&gt;
&lt;li&gt;Detach the old volume from the new instance&lt;/li&gt;
&lt;li&gt;Attach the old volume to the first instance, ensuring that you set the device to /dev/sda1&lt;/li&gt;
&lt;li&gt;Start the old instance&lt;/li&gt;
&lt;li&gt;Connect with Remote Desktop, add new rules to the Windows Firewall to allow for the port that you need&lt;/li&gt;
&lt;li&gt;Ensure that Windows Firewall is running, you may need to edit the registry again and reboot to start it properly&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This should get you back into the machine without having to go through AWS premium support.&lt;/p&gt;
&lt;p&gt;Now, the other tip I have: The micro instance I use is extremely weak, CPU-wise. I noticed that configuring items while connected via RDP was unbearably slow, and then I realized that the RDP window was far larger and used far more colors than I really needed. I found a site which contains many &lt;a href="http://coe.uncc.edu/mosaic/remote_desk/RDP%20File%20Settings.htm" target="_blank"&gt;RDP settings&lt;/a&gt; which you can set within the text-editable RDP file, and so I created a new RDP file with the server address, new port number, window height, window width, and color depth (session bpp), which makes my RDP sessions on my micro instance very snappy. Silly that I didn't realize this before, but now I know.&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/08/31/More-Amazon-EC2-Bits.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/08/31/More-Amazon-EC2-Bits.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=b9a9b4ab-e2a9-4d72-ab3a-48d6cb7442ae</guid>
      <pubDate>Wed, 31 Aug 2011 11:45:00 -0400</pubDate>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=b9a9b4ab-e2a9-4d72-ab3a-48d6cb7442ae</pingback:target>
      <slash:comments>90</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=b9a9b4ab-e2a9-4d72-ab3a-48d6cb7442ae</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/08/31/More-Amazon-EC2-Bits.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=b9a9b4ab-e2a9-4d72-ab3a-48d6cb7442ae</wfw:commentRss>
    </item>
    <item>
      <title>Sudoku Solver in Silverlight</title>
      <description>&lt;p&gt;I wrote up a quick Sudoku solver in Silverlight, using the backtracking technique. There's probably some more optimization to do, and I really need to figure out how to properly get the UI thread updated in realtime while it's solving it, but I'm pretty happy that I was able to at least get this going.&lt;/p&gt;
&lt;p&gt;        &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400px" height="300px"&gt;
		  &lt;param name="source" value="/ClientBin/SudokuSolverCS.xap"/&gt;
		  &lt;param name="onError" value="onSilverlightError" /&gt;
		  &lt;param name="background" value="white" /&gt;
		  &lt;param name="minRuntimeVersion" value="4.0.50826.0" /&gt;
		  &lt;param name="autoUpgrade" value="true" /&gt;
		  &lt;a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=4.0.50826.0" style="text-decoration:none"&gt;
 			  &lt;img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/&gt;
		  &lt;/a&gt;
	    &lt;/object&gt;&lt;iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"&gt;&lt;/iframe&gt;
&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/07/08/Sudoku-Solver-in-Silverlight.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/07/08/Sudoku-Solver-in-Silverlight.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=704c1013-52ff-435d-9e8a-d1917e84d2fb</guid>
      <pubDate>Fri, 08 Jul 2011 10:02:00 -0400</pubDate>
      <category>C#</category>
      <category>Silverlight</category>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=704c1013-52ff-435d-9e8a-d1917e84d2fb</pingback:target>
      <slash:comments>18</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=704c1013-52ff-435d-9e8a-d1917e84d2fb</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/07/08/Sudoku-Solver-in-Silverlight.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=704c1013-52ff-435d-9e8a-d1917e84d2fb</wfw:commentRss>
    </item>
    <item>
      <title>Quick bit on Amazon EC2</title>
      <description>&lt;p&gt;This blog is hosted on a micro instance at EC2. I figured this would be enough, and so far, with the tiny [zero] amount of traffic I've been getting, this has proved perfectly fine.&lt;/p&gt;
&lt;p&gt;However, I was also hoping I could do some experimentation with Silverlight or general .Net development on this instance. On attempting to install VS2010 Express on this instance, I realized things were going extremely slowly. I realized that it just wasn't going to happen when I looked at &lt;a href='http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?concepts_micro_instances.html'&gt;this documentation&lt;/a&gt;, which really showed me that the CPU (aside from the RAM) of my micro instance just wasn't going to cut it to run a heavy IDE like Visual Studio.&lt;/p&gt;
&lt;p&gt;My new plan: I'm currently setting up a large instance, which I'm going to run any development on, and then deploy to this machine. Hopefully, this will help me keep costs down; instead of having a gigantic constant cost to run a large instance indefinitely, I'll just kick up the large instance when I want to do some experimentation ($0.48/hr, not bad for a pretty hefty machine), and keep the micro instance constantly up to deal with hosting whatever I put together.&lt;/p&gt;
&lt;p&gt;Next up: I'm going to try and create a Sudoku solver in silverlight (probably done before) just to see how difficult it is to put together.&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/07/06/Quick-bit-on-Amazon-EC2.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/07/06/Quick-bit-on-Amazon-EC2.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=7d14445d-451e-4d33-b5de-311cac83c436</guid>
      <pubDate>Wed, 06 Jul 2011 20:56:00 -0400</pubDate>
      <category>EC2</category>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=7d14445d-451e-4d33-b5de-311cac83c436</pingback:target>
      <slash:comments>138</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=7d14445d-451e-4d33-b5de-311cac83c436</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/07/06/Quick-bit-on-Amazon-EC2.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=7d14445d-451e-4d33-b5de-311cac83c436</wfw:commentRss>
    </item>
    <item>
      <title>On Diagnosing Infinite Loops with WinDBG</title>
      <description>&lt;p&gt;Imagine this scenario: With not much traffic hitting your site, the entire server has ground to a halt and the CPU is pegging at 100%. No requests are being serviced, despite IIS taking all available CPU time. What's going on? One potential issue is that you have a poorly written page or method with an infinite loop.
&lt;/p&gt;
&lt;p&gt;I ran across this very issue in a production version of a page a few months ago. After a seemingly random certain amount of time serving pages normally, our servers would start to individually stop responding to requests, with a CPU that was completely saturated. Our own internal analysis ability was woefully inadequate at the time, so we used an MSDN support ticket to ask for help in diagnosing the issue.&lt;/p&gt;
&lt;p&gt;Once we had a server in the 'bad' state, we pulled a DebugDiag dump as per Microsoft's instructions, and shipped it off. About a week later, they told us that they thought they had spotted the issue: An infinite loop. They even were able to pinpoint the general code and give us a stacktrace of the problematic issue.&lt;/p&gt;
&lt;p&gt;After fixing the issue, I got to thinking: How were they able to spot the issue? Was there something that we could do the next time and try and shave some of that turnaround time down? Thankfully, one of my teammates was thinking the same thing and sent an email to Microsoft. They provided a link to &lt;a href='http://msdn.microsoft.com/en-us/windows/hardware/gg463009'&gt;WinDBG&lt;/a&gt;, and gave us a few quick pointers on how to use it.&lt;/p&gt;
&lt;p&gt;After receiving the pointers, I played with the dump and WinDBG quite a bit and came up with a process that my teammates can use if there is a similar situation in the future:
&lt;ol&gt;&lt;li&gt;Get the server into the 'bad' state&lt;/li&gt;
&lt;li&gt;Pull a DebugDiag dump from the server&lt;/li&gt;
&lt;li&gt;Open up WinDBG, and open the dump from there&lt;/li&gt;
&lt;li&gt;If necessary, run this command in WinDBG to setup the downloading of Microsoft Debugging symbols: &lt;b&gt;.sympath SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Run this command to setup SOS: &lt;b&gt;.loadby sos mscorwks&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Run this command to see long-running threads: &lt;b&gt;!runaway&lt;/b&gt; &lt;/lI&gt;
&lt;li&gt;From the top down, see what each thread is doing by issuing these commands in order:
&lt;ol&gt;&lt;li&gt;&lt;b&gt;~[threadnumber]s&lt;/b&gt; - Switches the WinDBG context to the threadnumber (for example, to switch to thread 3, type &lt;b&gt;~3s&lt;/b&gt;)&lt;/li&gt;&lt;li&gt;&lt;b&gt;!clrstack&lt;/b&gt; - Shows you the stacktrace of the current thread, as long as current thread is a managed thread&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;If more information is needed on a particular stacktrace, try running &lt;b&gt;!clrstack -a&lt;/b&gt;, which will give you memory locations for objects that you can examine to determine more information. For example, relatively early on in the output of that, there should be a Page or Context variable with some numeric memory address assigned to it, which can be successively dug through with &lt;b&gt;!dumpobject [numericMemoryAddress]&lt;/b&gt; (again, remove the square brackets) to find the request URL, form variables, session variables, etc.&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;
&lt;p&gt;Hopefully, with the process above, you'll be able to diagnose at least very simple infinite loops and save yourself the ticket and the time to wait for MSDN support to get back to you. There is another extension similar to SOS called PSSCOR2 that I will be going over in a future post. Hit me with a comment if this helped you, or if there's anything you think is wrong!&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/07/05/On-Diagnosing-Infinite-Loops-with-WinDBG.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/07/05/On-Diagnosing-Infinite-Loops-with-WinDBG.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=938877b8-4402-45d8-880d-3a9c80bd8caa</guid>
      <pubDate>Tue, 05 Jul 2011 23:17:00 -0400</pubDate>
      <category>C#</category>
      <category>DebugDiag</category>
      <category>WinDBG</category>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=938877b8-4402-45d8-880d-3a9c80bd8caa</pingback:target>
      <slash:comments>19</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=938877b8-4402-45d8-880d-3a9c80bd8caa</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/07/05/On-Diagnosing-Infinite-Loops-with-WinDBG.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=938877b8-4402-45d8-880d-3a9c80bd8caa</wfw:commentRss>
    </item>
    <item>
      <title>On simplistic performance analysis</title>
      <description>&lt;p&gt;Recently, I was asked to take a look at a poorly performing ASP.Net application. I'd like to document the process I used to get quick performance gains to grab some time to further analyze the root cause.&lt;/p&gt; 
&lt;p&gt;The performance tests that were being run prior to me getting on the case were showing a big amount of CPU time being spent on the webserver, but the DB server having around half as much utilization. Given my understanding of the application, which was that the webserver shouldn't be doing near as much work as the DB server, this was a bit troubling. Knowing that another performance test run would just show me similar numbers, without any idea of root cause, I asked my teammates to pull some DebugDiag dumps while running another performance test.&lt;/p&gt; 
&lt;p&gt;When I got my hands on the dumps, I found that many threads were busy processing XML files. Doing a deeper analysis into what XML files were being read, and why, I found that there was a bit of code that was looking through a single XML file (from disk, no less!) multiple times per page load. Obviously, this was not helping performance at all, and helped account for why the web server was struggling. The code was seeking through the XMLDocument, breaking the loop and disposing of the file handle when finding the entry it was looking for. This wasn't the most efficient way of doing things, but thankfully, this lent itself well to an easy fix.&lt;/p&gt; 
&lt;p&gt;The first quick idea I had was to just cache the XMLDocument object in memory (application variable) to avoid having to constantly hit the disk, and then allow the previous code to loop through the nodes. This helped reduce the amount of IO on each page load, and this would have made a pretty good improvement in and of itself. Looking more closely at what the code was doing, however, I realized that the code itself was basically using the XML file as a dictionary of sorts. &lt;/p&gt; 
&lt;p&gt;The final bit of code now reads the XML file on application startup, and stores the entries in a Hashtable object in an application variable. The old code has been modified to query the Hashtable object, thus saving even more time (why bother looping through nodes when we can get an instant response?)&lt;/p&gt; 
&lt;p&gt;Doing this fix resulted in much more throughput on our next performance test. The webserver and DB's CPU consumption started to even out a bit, which was a great indication that we were making a lot of progress with a quick fix.&lt;/p&gt; 
&lt;p&gt;Some key takeaways:
&lt;ul&gt; 
&lt;li&gt;DebugDiag is a great tool for getting a snapshot of what exactly is going on in your application at any given time. If there are many threads working on something, you have empirical evidence that your application spends a long time doing whatever it is those threads are doing, which can help to diagnose where your bottlenecks are.&lt;/li&gt; 
&lt;li&gt;Without load, you won't get much out of a DebugDiag dump, as it records just whatever is going on the instant you take a dump. Thus, you'll just get a bunch of threads doing a whole lot of nothing.&lt;/li&gt; 
&lt;li&gt;Once you've found a potential issue, and have an initial quickfix in mind, take a step back and determine what the code itself is supposed to be doing. Is there a better way to rewrite your fix?&lt;/li&gt; 
&lt;li&gt;Don't blindly assume that your new code is going to improve performance. Always run another performance test after your proposed fix to ensure that performance doesn't stay the same, or that it even becomes worse&lt;/li&gt; 
&lt;/ul&gt; 
&lt;/p&gt;</description>
      <link>http://www.brucel.ee/sharpblog/post/2011/07/05/On-simplistic-performance-analysis.aspx</link>
      <comments>http://www.brucel.ee/sharpblog/post/2011/07/05/On-simplistic-performance-analysis.aspx#comment</comments>
      <guid>http://www.brucel.ee/sharpblog/post.aspx?id=ebb4ba2e-2c7e-4920-867a-8835914e8067</guid>
      <pubDate>Tue, 05 Jul 2011 19:42:00 -0400</pubDate>
      <category>C#</category>
      <category>Performance</category>
      <category>DebugDiag</category>
      <dc:publisher>jangie</dc:publisher>
      <pingback:server>http://www.brucel.ee/sharpblog/pingback.axd</pingback:server>
      <pingback:target>http://www.brucel.ee/sharpblog/post.aspx?id=ebb4ba2e-2c7e-4920-867a-8835914e8067</pingback:target>
      <slash:comments>11</slash:comments>
      <trackback:ping>http://www.brucel.ee/sharpblog/trackback.axd?id=ebb4ba2e-2c7e-4920-867a-8835914e8067</trackback:ping>
      <wfw:comment>http://www.brucel.ee/sharpblog/post/2011/07/05/On-simplistic-performance-analysis.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.brucel.ee/sharpblog/syndication.axd?post=ebb4ba2e-2c7e-4920-867a-8835914e8067</wfw:commentRss>
    </item>
  </channel>
</rss>