<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sepia Labs &#187; Uncategorized</title>
	<atom:link href="http://sepialabs.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://sepialabs.com/blog</link>
	<description>Know who you&#8217;re sharing with.</description>
	<lastBuildDate>Mon, 20 Aug 2012 16:51:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Finding Memory Leaks in Azure</title>
		<link>http://sepialabs.com/blog/2012/08/20/finding-memory-leaks-in-azure/</link>
		<comments>http://sepialabs.com/blog/2012/08/20/finding-memory-leaks-in-azure/#comments</comments>
		<pubDate>Mon, 20 Aug 2012 16:51:46 +0000</pubDate>
		<dc:creator>Brian Reischl</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sepialabs.com/blog/?p=93</guid>
		<description><![CDATA[Tracking down memory leaks isn&#8217;t anyone&#8217;s idea of a good time.  There are a lot of great articles out there, but they can be hard to find, and some of them are getting a little long in the tooth. Things have changed since 2004! It turns out that you can find memory leaks in your [...]]]></description>
			<content:encoded><![CDATA[<p>Tracking down memory leaks isn&#8217;t anyone&#8217;s idea of a good time.  There are a lot of great articles out there, but they can be hard to find, and some of them are getting a little long in the tooth. Things have changed since 2004! It turns out that you can find memory leaks in your Azure apps without too much effort, and without buying any tools. Here&#8217;s how.</p>
<p><span id="more-93"></span></p>
<h2>Setup</h2>
<p>You&#8217;ll need a couple of things to get started. First, make sure you&#8217;ve enabled RDP access to your Azure roles. It&#8217;s pretty easy to set up through Visual Studio, and there are plenty of walkthroughs already, so I&#8217;m not going to cover it. If you didn&#8217;t have RDP set up already, then re-deploy your application with RDP enabled.</p>
<p>Second, you need WinDbg which is part of the Debugging Tools for Windows. WinDbg is not as easy to use as some of the commercial products, but if you&#8217;ve seen a command line before then you&#8217;ll be fine. It also has the notable advantage of being free. You can get the installer <a title="Windows Debugging Tools Download" href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" target="_blank">here</a>. It does take a little one-time configuration &#8211; I recommend the Basic Configuration section of <a title="WinDbg Basic Configuration" href="http://blogs.msdn.com/b/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx" target="_blank">this post</a>.</p>
<h2>Collecting a Memory Dump</h2>
<p>Once the setup is out of the way, you need to collect a memory dump. To do that, you need to RDP into your machine, but with a slight settings change that&#8217;ll help you download the dump file.</p>
<p>Go to the Azure portal, select an instance of your role, and hit the Connect button. That should download a .RDP file to your machine. Don&#8217;t open it immediately, we want to change settings to share your desktop&#8217;s drive to the Azure VM. Go find the .RDP file on your disk, right click it and select &#8220;Edit&#8221;. Go to the &#8220;Local Resources&#8221; tab, click the &#8220;More&#8221; button, and share one of your drives. It&#8217;ll look something like this:</p>
<div id="attachment_94" class="wp-caption aligncenter" style="width: 461px"><a href="http://sepialabs.com/blog/wp-content/uploads/2012/08/RDPConfig.png"><img class="size-full wp-image-94" src="http://sepialabs.com/blog/wp-content/uploads/2012/08/RDPConfig.png" alt="RDP Configuration" width="451" height="896" /></a><p class="wp-caption-text">Changing settings for RDP</p></div>
<p>&nbsp;</p>
<p>Now connect to the VM as normal. Once you&#8217;re logged in, open Windows Explorer and you verify that your desktop drive shows up in the list of drives. Then open Task Manager and find the leaking process. If you&#8217;re debugging a worker role, it&#8217;ll probably be <em>WaWorkerHost.exe</em>. For web roles, it will probably be <em>w3wp.exe</em>. (Or you could just look for the one that&#8217;s using a whole lot of memory!) When you&#8217;ve found the misbehaving process right click on it and select &#8220;Create Dump File&#8221;.</p>
<p><a href="http://sepialabs.com/blog/wp-content/uploads/2012/08/CreateDumpFile.png"><img class="aligncenter size-full wp-image-95" src="http://sepialabs.com/blog/wp-content/uploads/2012/08/CreateDumpFile.png" alt="" width="400" height="445" /></a></p>
<p>&nbsp;</p>
<p>This will take a while. When it&#8217;s done you&#8217;ll see a dialog telling you where to find the dump file. Locate the dump file, then copy it to the drive you shared from your desktop. Dump files tend to be very large, so this will probably take a few minutes.</p>
<h2>Analyzing the Dump File</h2>
<p>Now you need crack open the dump file and see what&#8217;s going on. The dump file contains a snapshot of all the memory in your program. We&#8217;re going to look through it to figure out what&#8217;s taking up all that memory. You&#8217;re basically looking for anything suspicious, such as a class that has thousands more instances than it should. Open WinDbg and use File -&gt; Open Crash Dump to open the dump file you just collected. Then type &#8220;.load sos&#8221; to load the .NET debugger module.</p>
<p>Now you need to get out your magnifying glass and detective hat, and try to figure out what&#8217;s going on in your program. I&#8217;m certainly no expert on this topic, but this approach worked for me.</p>
<ol>
<li>Run <em>!dumpheap -stat.</em> This will dump out a summary of what classes are using the most memory, with the biggest ones at the bottom. Look for anything that seems suspicious.</li>
<li>When you find something suspicious, copy the MT value (the first column), then run <em>!dumpheap -mt &lt;copied mt value&gt;. </em>This will dump out a list of all the instances of that object.</li>
<li>Copy the Address (first column, again) for an object, and run <em>!gcroot &lt;copied address&gt;. </em>This should show you what objects are referring to that object instance. It should give you an idea of who created it, and why it hasn&#8217;t been reclaimed. Repeat the process for several objects, and look for patterns.</li>
</ol>
<p>Hopefully the above gives you some ideas. If not, try taking two or three dumps and look at what&#8217;s been allocated in the time between them. If you&#8217;re still stuck, Tess Ferrandez wrote a very good and still relevant blog post series about this topic. I particularly recommend <a href="http://blogs.msdn.com/b/tess/archive/2008/03/17/net-debugging-demos-lab-6-memory-leak-review.aspx" target="_blank">part 6</a> and <a href="http://blogs.msdn.com/b/tess/archive/2007/08/13/asp-net-memory-investigation.aspx" target="_blank">this followup post</a> for ASP.NET problems.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://sepialabs.com/blog/2012/08/20/finding-memory-leaks-in-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Profiling Azure Storage with Fiddler part 3: Don&#8217;t Repeat Yourself</title>
		<link>http://sepialabs.com/blog/2012/05/21/profiling-azure-storage-with-fiddler-part-3-dont-repeat-yourself/</link>
		<comments>http://sepialabs.com/blog/2012/05/21/profiling-azure-storage-with-fiddler-part-3-dont-repeat-yourself/#comments</comments>
		<pubDate>Tue, 22 May 2012 01:43:10 +0000</pubDate>
		<dc:creator>Brian Reischl</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sepialabs.com/blog/?p=64</guid>
		<description><![CDATA[In previous posts I’ve talked about profiling your Azure Storage transactions with Fiddler, and one particular problem to look for. In this post I’ll talk about a more common problem; getting the same piece of data repeatedly. This is always a performance problem, as your app wastes extra time waiting for responses from the storage [...]]]></description>
			<content:encoded><![CDATA[<p>In previous posts I’ve talked about <a href="http://sepialabs.com/blog/?p=45">profiling your Azure Storage transactions with Fiddler</a>, and <a href="http://sepialabs.com/blog/?p=49">one particular problem to look for</a>. In this post I’ll talk about a more common problem; getting the same piece of data repeatedly. This is always a performance problem, as your app wastes extra time waiting for responses from the storage mechanism. It’s also a scalability problem, because you’re making that storage mechanism work harder than it needs to. Although the problem is not unique to Azure Storage, there is a new twist: you’re paying for each storage transaction. Hitting storage too much hits you directly in the wallet, so it’s more important than ever that you optimize your data access logic.</p>
<p>To demonstrate the problem I have set up my Glassboard API instance to do no caching whatsoever. I then ran a unit test which simulates a user getting his Newsfeed, then posting a status. I highlighted each set of repeated calls in a different color.</p>
<p><a href="http://sepialabs.com/blog/wp-content/uploads/2011/08/Fiddler_Repeated_Requests.png"><img class="alignnone size-large wp-image-65" src="http://sepialabs.com/blog/wp-content/uploads/2011/08/Fiddler_Repeated_Requests-1024x294.png" alt="Repeated Storage Requests" width="640" height="183" /></a></p>
<p>Just look at all those colorful, repeated requests! There are 8 requests there, slowing down our app and sucking up money.</p>
<p>Depending on your application there are many possible ways to get rid of repeated requests. You may be able to design them out of the system, share data between layers, or implement local or distributed caches. We used a combination of all of these to fix our problem in Glassboard. With our caching re-enabled, the same test results in this HTTP trace.</p>
<p><a href="http://sepialabs.com/blog/wp-content/uploads/2011/08/Fiddler_Not_Repeated_Requests.png"><img class="alignnone size-large wp-image-66" src="http://sepialabs.com/blog/wp-content/uploads/2011/08/Fiddler_Not_Repeated_Requests-1024x157.png" alt="Storage Requests Not Repeated" width="640" height="98" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://sepialabs.com/blog/2012/05/21/profiling-azure-storage-with-fiddler-part-3-dont-repeat-yourself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sepia Labs launches</title>
		<link>http://sepialabs.com/blog/2011/06/08/sepia-labs-launches/</link>
		<comments>http://sepialabs.com/blog/2011/06/08/sepia-labs-launches/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 04:45:28 +0000</pubDate>
		<dc:creator>Walker Fenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sepialabs.com/blog/?p=5</guid>
		<description><![CDATA[Good morning. We&#8217;re Sepia Labs. Nice to meet you too. You don&#8217;t know us because we&#8217;re new. Well, sort of new. Sepia Labs is a software company comprised of a few folks who have some history in the software business, notably Brent Simmons, the creator of NetNewsWire, and Nick Bradbury, creator of FeedDemon and TopStyle. [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>Good morning. We&#8217;re Sepia Labs. Nice to meet you too.</p>
<p>You don&#8217;t know us because we&#8217;re new. Well, sort of new. Sepia Labs is a software company comprised of a few folks who have some history in the software business, notably <a href="http://inessential.com/">Brent Simmons</a>, the creator of NetNewsWire, and <a href="http://nick.typepad.com/">Nick Bradbury</a>, creator of FeedDemon and TopStyle. Together with <a href="http://nickharris.wordpress.com/">Nick Harris</a>, <a href="http://twitter.com/#!/jennyblumberg">Jenny Blumberg</a>, <a href="http://beakerbrain.blogspot.com/">Brian Reischl</a> and myself (<a href="http://www.linkedin.com/in/walkerfenton">Walker Fenton</a>) &#8211; we have started this new venture called Sepia Labs.</p>
<p>We are spinning off from NewsGator Technologies, Inc, we are the team that was largely responsible for NewsGator&#8217;s consumer facing business.</p>
<p>Our mission at Sepia Labs is simple. First and foremost, we want to make great software. We want our software to provide instant utility, to be good looking, fast, and fun to use. Our first product, <a href="http://www.glassboard.com">Glassboard</a>, reflects this mission, and we hope you&#8217;ll agree.</p>
<p><a href="http://www.glassboard.com">Glassboard</a> is an app focused on sharing. Yes, a bit like Facebook or Twitter, but we take privacy seriously. &#8220;Know who you&#8217;re sharing with&#8221; is the tagline. And we mean it.</p>
<p>Glassboard is launching in July. If you would like to keep posted, head over to Glassboard.com and give us your email. We won&#8217;t spam you or share your email with anyone else. We&#8217;ll just let you know when the app is ready.</p>
<p>Thanks for visiting.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://sepialabs.com/blog/2011/06/08/sepia-labs-launches/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: sepialabs.com @ 2013-06-20 03:09:12 -->