<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.davidhogue.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>David Hogue's Blog</title>
	
	<link>http://davidhogue.com/blog</link>
	<description>This is a personal blog of mine, mostly about things I run into while at work.</description>
	<lastBuildDate>Thu, 03 May 2012 16:09:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.davidhogue.com/DavidHogue" /><feedburner:info uri="davidhogue" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Reclaiming my work day</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/DhnHRrwWDdQ/</link>
		<comments>http://davidhogue.com/blog/2012/05/reclaiming-my-work-day/#comments</comments>
		<pubDate>Thu, 03 May 2012 16:09:17 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=920</guid>
		<description><![CDATA[So this isn&#8217;t a technical post, but still applies to developers. I have had trouble managing my time and the amount of work coming in. I&#8217;m sure most people that work at a desk run into this every now and &#8230; <a href="http://davidhogue.com/blog/2012/05/reclaiming-my-work-day/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So this isn&#8217;t a technical post, but still applies to developers. I have had trouble managing my time and the amount of work coming in. I&#8217;m sure most people that work at a desk run into this every now and then.</p>
<p>Here&#8217;s four things I try to do that help:</p>
<ul>
<li>I try to keep my inbox empty. See http://inboxzero.com/.</li>
<li>I try not to check my email all the time. This is hard for me.</li>
<li>I try to make a note of anything that&#8217;s nagging at the back of my mind while I&#8217;m trying to focus.</li>
<li>I drink better coffee now that I&#8217;m much better at making it. <img src='http://davidhogue.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>They don&#8217;t make things perfect, but at least I feel like I&#8217;m in control now.</p>
<h3>Email</h3>
<p>I lose a lot of time to things like emails coming in, IM conversations. Just one email or IM discussion can easily eat an hour. I really try to be as helpful as I can, but sometimes I don&#8217;t have time left at the end of the day.</p>
<p><img style="float: right; padding-left: 5px" src="http://davidhogue.com/wp-uploads/2012/05/Inbox-numbers.png" alt="" title="Inbox numbers" width="215" height="108" class="alignright size-full wp-image-934" /></p>
<p>I&#8217;ve been pretty good about implementing <a href="http://inboxzero.com/">Inbox Zero</a>. I rarely have any emails left in my inbox by the end of the day and I have filters for mailing lists and CC&#8217;s. However I&#8217;d like to start processing my email in batches, so I don&#8217;t have to deal with it first thing in the day. The problem is that as soon as Outlook opens and I glance at that number, I feel compelled to take a few minutes and at least sort them. And then if there&#8217;s just one that doesn&#8217;t make sense or asks me to do something I can&#8217;t get done, it nags at me the rest of the day.</p>
<h3>Notes</h3>
<p>Another thing that&#8217;s helping a lot is just writing down anything I can&#8217;t get to right at the moment. Sometimes I&#8217;ll be debugging some problem and I&#8217;ll notice code that could be improved, or I get an idea that would make error logging easier, or whatever. Rather than trying to make the change right away and get sidetracked, I used to try to remember that until I got done. The problem was that I would either forget about it or I&#8217;d keep thinking about it when I needed to focus on other things.</p>
<p>Now I just create a one line note in Evernote. I can move it and tag it later when I have time. Or sometimes I&#8217;ll just delete it outright because it doesn&#8217;t seem like such a hot idea anymore.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/DhnHRrwWDdQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2012/05/reclaiming-my-work-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2012/05/reclaiming-my-work-day/</feedburner:origLink></item>
		<item>
		<title>Plugging a ConnectionProvider in to NHibernate to connect to multiple databases</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/zIAfueeYY3k/</link>
		<comments>http://davidhogue.com/blog/2012/02/plugging-in-a-connectionprovider-to-nhibernate-to-connect-to-multiple-databases/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 14:53:04 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[nhibernate]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=901</guid>
		<description><![CDATA[I recently had a scenario where I needed to connect to a variety of databases depending on context. The databases all shared the same schema, the contents were just partitioned out based on customer. I’d originally done this with many &#8230; <a href="http://davidhogue.com/blog/2012/02/plugging-in-a-connectionprovider-to-nhibernate-to-connect-to-multiple-databases/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently had a scenario where I needed to connect to a variety of databases depending on context. The databases all shared the same schema, the contents were just partitioned out based on customer.</p>
<p>I’d originally done this with many SessionFactories (<a href="http://codebetter.com/karlseguin/2009/03/30/using-nhibernate-with-multiple-databases/">like this post does</a>.)</p>
<p>After a while I ran into memory usage issues (See <a href="http://davidhogue.com/blog/2011/12/some-windbg-notes-for-troubleshooting-excessive-memory-usage/">this post about debugging with WinDbg</a>.)</p>
<p>So that’s when I started looking for another option. What I wanted to do was use one factory and supply it with connections to the right databases.</p>
<h3>The Provider</h3>
<pre class="brush: c#">
/// &lt;summary&gt;
/// Connection provider that will override the default connection string and use one that's
/// been specified for this thread.
/// &lt;/summary&gt;
public class DbSpecificConnectionProvider : DriverConnectionProvider
{
    /// &lt;summary&gt;
    /// Returns a new connection using the connection string set in ThreadConnectionString.
    /// &lt;/summary&gt;
    public override IDbConnection GetConnection()
    {
        var connection = Driver.CreateConnection();
        try
        {
            connection.ConnectionString = GetConnectionStringFromContext();
            connection.Open();
        }
        catch (DbException)
        {
            connection.Dispose();
            throw;
        }
        return connection;
    }
}
</pre>
<p>This isn’t too complex really. It inherits from the default provider of DriverConnectionProvider and overrides the GetConnection function. It then gets a connection from the driver, sets the connection string and opens the connection. If there are any errors it’ll cleanup the connection before exiting.</p>
<h3>Additional bits</h3>
<p>You’ll also need to edit your configuration to tell it about the new provider:</p>
<pre class="brush: xml">
&lt;property name="connection.provider"&gt;
  My.Namespace.DbSpecificConnectionProvider, MyAssembly
&lt;/property&gt;
</pre>
<p>And if you are using second level caching, you might need to implement a caching provider so that the cache doesn’t get cross-contaminated.</p>
<p>Now this hasn’t had that much testing yet, so I’m still being a little cautious with it. But if it works, it’s a nice clean solution to my specific problem.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/zIAfueeYY3k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2012/02/plugging-in-a-connectionprovider-to-nhibernate-to-connect-to-multiple-databases/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2012/02/plugging-in-a-connectionprovider-to-nhibernate-to-connect-to-multiple-databases/</feedburner:origLink></item>
		<item>
		<title>Where does the time go?</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/x_dcUeQPG60/</link>
		<comments>http://davidhogue.com/blog/2012/01/where-does-the-time-go/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 00:31:07 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=879</guid>
		<description><![CDATA[It seems like I don&#8217;t have any time these days. I&#8217;m getting a lot done, but is it the stuff I want to be spending my time on? And could I be more efficient about getting through it? Between work &#8230; <a href="http://davidhogue.com/blog/2012/01/where-does-the-time-go/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It seems like I don&#8217;t have any time these days. I&#8217;m getting a lot done, but is it the stuff I want to be spending my time on? And could I be more efficient about getting through it?</p>
<p>Between work eating up as much time as I will let it, spending time with my girl, being somewhat social, upgrading people&#8217;s PCs, trying to get through a game, and trying to read more (currently in the middle of re-reading the Hobbit!) I have no free time. Oh yeah, I should also mention that trying to write a blog will eat up a bunch of time too. <img src='http://davidhogue.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Yeah, I want to do a lot. Probably more than I am realistically able to. However, with some work I am able to keep a surprising number of things going. Not everything I&#8217;d ever like to do, but more than I would have thought.</p>
<p>Some things that have helped:</p>
<ul>
<li>Task lists, calendars and notebooks. This probably deserves it&#8217;s own post. I&#8217;m using a bit of GTD (aka Getting Things Done) with Outlook, Google Calendar and Evernote. There are entire blogs dedicated to this that might be a better resource.
</li>
<li>Exercise and sleep. Yes they both take time, but you&#8217;re able to better spend the rest of the time if you stay on top of them. I&#8217;m honestly still working on this. It&#8217;s not easy!
</li>
<li>Getting up a bit earlier. I&#8217;m usually in bed pretty early these days, which means I sometimes get up earlier than I used to. I was never a morning person, but I do see the appeal. I&#8217;m writing this in the morning before I have to work.</li>
<li>I&#8217;m spending less time on the things that don&#8217;t interest me as much. I spend far less time on Facebook now. Less time with the Xbox even than I used to. I would like to spend some free time coding again.
</li>
<li>If I still don&#8217;t have time to do something at some point I have to decide what to drop. I can always take it up later if I want, but it&#8217;s still not usually an easy decision.
</ul>
<p>So that&#8217;s how I&#8217;m getting by until I can make a 30 hour day or invent time travel.</p>
<p>So what do you think? Was this useful? Do you have any tips to add?</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/x_dcUeQPG60" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2012/01/where-does-the-time-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2012/01/where-does-the-time-go/</feedburner:origLink></item>
		<item>
		<title>Some WinDbg notes for troubleshooting excessive memory usage</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/wz6r4LBpYUU/</link>
		<comments>http://davidhogue.com/blog/2011/12/some-windbg-notes-for-troubleshooting-excessive-memory-usage/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 17:45:43 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[windbg]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=806</guid>
		<description><![CDATA[A little while ago I ran into some problems with the w3wp process gobbling up tons of memory. It ate up so much memory that after running for a few hours with high traffic, it would automatically get restarted by &#8230; <a href="http://davidhogue.com/blog/2011/12/some-windbg-notes-for-troubleshooting-excessive-memory-usage/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a style="float: right; margin: 5px;" href="http://davidhogue.com/wp-uploads/2011/12/WinDbg-gcroot.png"><img src="http://davidhogue.com/wp-uploads/2011/12/WinDbg-gcroot-300x240.png" alt="!GCRoot" title="Output of the !GCRoot WinDbg command" width="300" height="240" class="alignright size-medium wp-image-847" /></a></p>
<p>A little while ago I ran into some problems with the w3wp process gobbling up tons of memory. It ate up so much memory that after running for a few hours with high traffic, it would automatically get restarted by IIS.</p>
<p>WinDbg isn&#8217;t the friendliest looking program, but if you know a few commands you can get quite a ways with it.</p>
<p>In my case the memory was used up by how we were pushing NHibernate to do some non-standard things. These same steps could be used to troubleshoot most generic memory usage problems.</p>
<h3 style="clear: right">Here&#8217;s the steps I followed to get through this:</h3>
<p><a style="float:right" href="http://davidhogue.com/wp-uploads/2011/12/WinDbg-PerfMon.png"><img src="http://davidhogue.com/wp-uploads/2011/12/WinDbg-PerfMon-300x228.png" alt="Performance Monitor" title="Performance Monitor" width="300" height="228" class="alignright size-medium wp-image-860" /></a></p>
<ol>
<li>I have a memory dump I made with <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653">Process Explorer</a> on the server when it had been running for 3 hours and was about to be recycled.</li>
<li>The Gen2 heap size was what was growing up to 1.4GB. The other heaps stayed about the same size for the life of the app. Which apparently is common when there is a memory leak. I was able to tell this with performance counters and then confirm it with windbg.</li>
<li>The type taking up the most memory is strings, after that various types of arrays. Which also seems normal, even if there weren’t a leak.</li>
<li>From a random sampling of strings, most look like SQL fragments, but some are HTML content. Makes sense, most of the strings in this particular app are going to be HTML or SQL.</li>
<li>WinDbg did take a very long time to do some operations on the 3GB memory dump. Using an SSD helped, but I still had to be patient for some operations</li>
<li>Finally it started looking like the NHibernate query cache was holding on to a bunch of data. There’s a similar issue that was discovered <a href="http://markmail.org/message/a3zftctucv65n27s#query:+page:1+mid:a3zftctucv65n27s+state:results">here</a>.</li>
<li>The data is rooted in a static property so it will never be garbage collected. Our code was written this way since the documentation said to only create each session factory once and store it.</li>
<li>One NHibernate SessionFactory on its own isn’t too bad, it only took up 34MB. Where it gets problematic is when we have a bunch of those in memory.</li>
<li><strike>In the near term, I think this can be fixed by using some <a href="http://msdn.microsoft.com/en-us/library/system.weakreference.aspx">WeakReferences</a>.</strike> Longer term I’d like to use only one or two SessionFactories.</li>
<li>I found out that a <a href="http://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache.aspx">MemoryCache</a> would be better than WeakReferences.
<ul>
<li>WeakReferences go away as soon as the garbage collector runs if nobody is using them, the cached items go away when memory is tight.</li>
<li>Even longer term, I&#8217;d like to get down to just a few or even one session factory. I think reading up on sharding might be the next step here.</li>
</ul>
</li>
</ol>
<h3>Links:</h3>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/bb190764.aspx">SOS.dll (SOS Debugging Extension)</a></li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc164138.aspx">Bugslayer: SOS: It&#8217;s Not Just an ABBA Song Anymore</a></li>
<li><a href="http://geekswithblogs.net/.netonmymind/archive/2006/03/14/72262.aspx">WinDbg / SOS Cheat Sheet</a></li>
<li><a href="http://blogs.msdn.com/b/delay/archive/2009/03/11/where-s-your-leak-at-using-windbg-sos-and-gcroot-to-diagnose-a-net-memory-leak.aspx">Where&#8217;s your leak at? [Using WinDbg, SOS, and GCRoot to diagnose a .NET memory leak]</a></li>
<li><a href="http://blogs.msdn.com/b/tess/archive/2010/03/01/new-commands-in-sos-for-net-4-0-part-1.aspx">New commands in SOS for .NET 4.0 Part 1</a></li>
<li><a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2008/08/27/new-silverlight-sos-dll-commands-heapstat-and-gcwhere.aspx">New Silverlight SOS.DLL Commands: !HeapStat and !GCWhere</a></li>
</ul>
<div style="float: right; margin: 5px;">
<p><a href="http://davidhogue.com/wp-uploads/2011/12/WinDbg-DumpHeap-stat.png"><img src="http://davidhogue.com/wp-uploads/2011/12/WinDbg-DumpHeap-stat-300x240.png" alt="!DumpHeap -stat" title="Output of the !DumpHeap -stat WinDbg command" width="300" height="240" class="alignright size-medium wp-image-839" /></a></p>
<p><a href="http://davidhogue.com/wp-uploads/2011/12/WinDbg-DumpHeap-strings.png"><img src="http://davidhogue.com/wp-uploads/2011/12/WinDbg-DumpHeap-strings-300x240.png" alt="!DumpHeap -type System.String" title="Output of the !DumpHeap -type System.String WinDbg command" width="300" height="240" class="alignright size-medium wp-image-843" /></a></p>
</div>
<h3>Useful WinDbg &#038; SoS commands:</h3>
<ul>
<li><code>.loadby sos clr</code> – loads SoS into windbg.
<ul>
<li><code>.load C:\SomePath\sos.dll</code> – can be used to load another version of sos.dll that was downloaded from the server.</li>
</ul>
</li>
<li><code>.prefer_dml 1</code> – makes addresses in the output clickable to get more details.</li>
<li><code>CTRL+Break</code> – stops the currently running command.</li>
<li><code>!Help</code> – lists all SoS commands.</li>
<li><code>!HeapStat</code> – lists some stats on where memory is used.</li>
<li><code>!EEHeap -gc</code> – lists start and end addresses for each heap.</li>
<li><code>!DumpHeap -stat [Begin] [End]</code> – Gives stats on what types are using up memory. Begin and End come from !EEHeap -gc, I wanted only Gen2.</li>
<li><code>!DumpHeap -Type &lt;Type&gt; [Begin] [End]</code> – Lists all instances of a type, like System.String, between Begin and End.</li>
<li><code>!DumpObj &lt;Address&gt;</code> – Prints out details on an object.</li>
<li><code>!GCWhere &lt;Address&gt;</code> – Prints out what heap an object is in, it’s address and size.</li>
<li><code>!GCRoot -nostacks &lt;Address&gt;</code> – Lists objects that have a reference to the object. The object at the root of the list is why the memory has not been garbage collected. This can take quite a while.</li>
<li><code>!ObjSize [Address]</code> – Lists the size of the object by adding up the size of all references. Can take a while if it needs to loop through a lot.</li>
</ul>
<h3 style="clear: right">Details:</h3>
<p>Here’s the output of !GCRoot 00000001805a8640 on a single string that contains a fragment of SQL. I also added some information on the total size while I was poking around.</p>
<p><code>DOMAIN(00000000001B4550):HANDLE(Pinned):73015e8:Root:  000000028010c068(System.Object[])-&gt;<br />
  00000001c0180668(System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib],[NHibernate.ISessionFactory, NHibernate]])-&gt; (1272.6 MB!)<br />
  000000020c29f578(System.Collections.Generic.Dictionary`2+Entry[[System.Guid, mscorlib],[NHibernate.ISessionFactory, NHibernate]][])-&gt; <span style="color: red">(1272.6 MB!)</span><br />
  00000002402b6208(NHibernate.Impl.SessionFactoryImpl)-&gt; <span style="color: red">(34.6 MB…)</span><br />
  00000002402b6628(NHibernate.Engine.Query.QueryPlanCache)-&gt;<br />
  00000002402b79c0(NHibernate.Util.SoftLimitMRUCache)-&gt;<br />
  00000002402b7a60(NHibernate.Util.LRUMap)-&gt;<br />
  00000002402b7ac0(System.Collections.Hashtable)-&gt;<br />
  00000002402b7b18(System.Collections.Hashtable+bucket[])-&gt;<br />
  00000001c08cecc8(NHibernate.Util.SequencedHashMap+Entry)-&gt;<br />
  00000001c08a6628(NHibernate.Engine.Query.HQLStringQueryPlan)-&gt;<br />
  00000001c08c9cf8(System.Object[])-&gt;<br />
  00000001c08c9c90(NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl)-&gt;<br />
  00000001c08ccc48(NHibernate.Hql.Ast.ANTLR.Tree.QueryNode)-&gt;<br />
  00000001c08caa48(NHibernate.Hql.Ast.ANTLR.Tree.FromClause)-&gt;<br />
  00000001c08cac58(NHibernate.Util.NullableDictionary`2[[System.String, mscorlib],[NHibernate.Hql.Ast.ANTLR.Tree.FromElement, NHibernate]])-&gt;<br />
  00000001c08cac80(System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[NHibernate.Hql.Ast.ANTLR.Tree.FromElement, NHibernate]])-&gt;<br />
  00000001c08cb748(System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[NHibernate.Hql.Ast.ANTLR.Tree.FromElement, NHibernate]][])-&gt;<br />
  00000001c08cb538(NHibernate.Hql.Ast.ANTLR.Tree.FromElement)-&gt;<br />
  00000001c08cb650(NHibernate.Hql.Ast.ANTLR.Tree.FromElementType)-&gt;<br />
  0000000180481ef0(NHibernate.Persister.Collection.BasicCollectionPersister)-&gt;<br />
  00000001805a83f0(NHibernate.Loader.Collection.BasicCollectionLoader)-&gt; <span style="color: red">(34.6 MB…)</span><br />
  00000001805a87a0(NHibernate.SqlCommand.SqlString)-&gt; <span style="color: red">(616 Bytes…)</span><br />
  00000001805a8740(System.Object[])-&gt;<br />
  00000001805a8640(System.String) <span style="color: red">(200 Bytes…)</span></code></p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/wz6r4LBpYUU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/12/some-windbg-notes-for-troubleshooting-excessive-memory-usage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/12/some-windbg-notes-for-troubleshooting-excessive-memory-usage/</feedburner:origLink></item>
		<item>
		<title>Performance Monitor Tips &amp; Tricks</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/g5kcbiX8zRk/</link>
		<comments>http://davidhogue.com/blog/2011/12/performance-monitor-tips-tricks/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 23:46:58 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[perfmon]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=758</guid>
		<description><![CDATA[I’ve been doing a lot of digging into performance monitor this last week or so and learned some new tricks. I thought I&#8217;d write this up and share what I found in case it&#8217;s useful in the future: Command line &#8230; <a href="http://davidhogue.com/blog/2011/12/performance-monitor-tips-tricks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’ve been doing a lot of digging into performance monitor this last week or so and learned some new tricks. I thought I&#8217;d write this up and share what I found in case it&#8217;s useful in the future:</p>
<ul>
<li>Command line tools: logman.exe, relog.exe and typeperf.exe.</li>
<ul>
<li><strong>Logman</strong> can be used to create new logs. It has one option that the GUI doesn&#8217;t have, and that is to run the same scheduled log each day.</li>
<li><strong>Relog</strong> can be used to convert log files from the binary .blg into .csv or SQL. It can also let you pull only specific counters or time spans out of a .blg. Another use is combining counter logs from multiple files.</li>
<li><strong>Typeperf</strong> can be used to get raw counter data from the command line.</li>
<li>There are some commands in PowerShell too, but for adding counters logman seems much less verbose.</li>
</ul>
<p></p>
<li>I have some productions servers logging from early morning until night and the files are only around 15MB or so.</li>
<ul>
<li>They’re only logging selected counters and only logging data once a minute.</li>
<li>Some counter logs can get large very quickly because they grab a lot of data every few seconds, but the file size seems to be capped around 3GB.</li>
<li>Here is the list of counters I’m currently capturing. I’d love to hear any suggestions if there are useful ones I missed.<code><br />
\.NET CLR Exceptions(_Global_)\# of Exceps Thrown / sec<br />
\.NET CLR Interop(_Global_)\# of Stubs<br />
\.NET CLR Loading(_Global_)\Bytes in Loader Heap<br />
\.NET CLR Loading(_Global_)\Current Assemblies<br />
\.NET CLR Loading(_Global_)\Rate of Assemblies<br />
\.NET CLR Memory(_Global_)\# Bytes in all Heaps<br />
\.NET CLR Memory(_Global_)\# Induced GC<br />
\.NET CLR Memory(_Global_)\% Time in GC<br />
\.NET CLR Memory(_Global_)\Gen 0 heap size<br />
\.NET CLR Memory(_Global_)\Gen 1 heap size<br />
\.NET CLR Memory(_Global_)\Gen 2 heap size<br />
\.NET CLR Memory(_Global_)\Large Object Heap size<br />
\ASP.NET\Application Restarts<br />
\ASP.NET\Request Execution Time<br />
\ASP.NET\Request Wait Time<br />
\ASP.NET\Requests Current<br />
\ASP.NET\Worker Process Restarts<br />
\ASP.NET Applications(__Total__)\Compilations Total<br />
\ASP.NET Applications(__Total__)\Errors During Execution<br />
\ASP.NET Applications(__Total__)\Request Execution Time<br />
\ASP.NET Applications(__Total__)\Request Wait Time<br />
\Memory\% Committed Bytes In Use<br />
\Memory\Available MBytes<br />
\Memory\Pages/sec<br />
\PhysicalDisk(_Total)\Avg. Disk sec/Read<br />
\PhysicalDisk(_Total)\Avg. Disk sec/Write<br />
\Process(_Total)\Handle Count<br />
\Process(_Total)\Virtual Bytes<br />
\Processor(_Total)\% Processor Time<br />
\Web Service(_Total)\Bytes Received/sec<br />
\Web Service(_Total)\Bytes Sent/sec<br />
\Web Service(_Total)\Get Requests/sec<br />
\Web Service(_Total)\Post Requests/sec<br />
</code>
</li>
</ul>
<p></p>
<li><a style="float: right" href="http://davidhogue.com/wp-uploads/2011/12/PerfmonSettings.png"><img src="http://davidhogue.com/wp-uploads/2011/12/PerfmonSettings-e1323212921916-150x51.png" alt="" title="PerfmonSettings" width="150" height="51" class="alignright size-thumbnail wp-image-768" /></a>There are a couple buttons in the toolbars for copying and pasting settings.</li>
<ul>
<li>These can be used to paste the settings into notepad and edit it as XML.</li>
<li>It was useful for using the same settings on multiple servers as well as getting the names of counters for the command line.</li>
<li>The Windows 7 Performance Monitor has a Scale Selected Counter option in the right click menu that will automatically change the scale setting so that the graph fits in the window.</li>
</ul>
</ul>
<h2>Examples</h2>
<p>As an example, here’s a couple graphs of a server I was testing a while ago. First, traffic to the server. It doesn’t look like it was all that busy, almost 5 requests a second on average:<br />
<img src="http://davidhogue.com/wp-uploads/2011/12/PerfmonGraph1.png" alt="" title="PerfmonGraph1" width="869" height="666" class="alignright size-full wp-image-787" /></p>
<p>And here’s memory usage, you can see how the Gen 2 heap size grows and grows up to around 1.5GB when the app pool recycles:<br />
<img src="http://davidhogue.com/wp-uploads/2011/12/PerfmonGraph2.png" alt="" title="PerfmonGraph2" width="869" height="663" class="alignright size-full wp-image-788" /></p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/g5kcbiX8zRk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/12/performance-monitor-tips-tricks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/12/performance-monitor-tips-tricks/</feedburner:origLink></item>
		<item>
		<title>Finally merged my old blog over to this one</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/aRKWvepThgw/</link>
		<comments>http://davidhogue.com/blog/2011/10/finally-merged-my-old-blog-over-to-this-one/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 18:09:31 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=605</guid>
		<description><![CDATA[I swear this is the last post I&#8217;m writing for a while on the topic of blogging. Really! It took me a while, but I finally merged the content from my old blog to this one. It wasn&#8217;t too hard &#8230; <a href="http://davidhogue.com/blog/2011/10/finally-merged-my-old-blog-over-to-this-one/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I swear this is the last post I&#8217;m writing for a while on the topic of blogging. Really!</p>
<p>It took me a while, but I finally merged the content from my old blog to this one. It wasn&#8217;t too hard since they&#8217;re both WordPress. Just export and then import. The parts that took the longest were finding a way to exclude the old posts from the RSS feed and setting up permanent redirects for all the posts and feeds.</p>
<p>Hopefully the transition goes smoothly from here on out. I&#8217;ll be watching my logs, stats, and webmaster tools over the next few days to make sure.</p>
<p>So now I need to get to writing some real content. There&#8217;s a lot of old (and probably outdated) content here now and I need to get it more up to date.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/aRKWvepThgw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/10/finally-merged-my-old-blog-over-to-this-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/10/finally-merged-my-old-blog-over-to-this-one/</feedburner:origLink></item>
		<item>
		<title>On Working Remotely and Practicing Writing Skills</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/RxKvnrP64rQ/</link>
		<comments>http://davidhogue.com/blog/2011/10/on-working-remotely-and-practicing-writing-skills/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 17:37:10 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[working remotely]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=111</guid>
		<description><![CDATA[I&#8217;ve been doing a decent amount of work outside the office recently (or telecommuting as they used to call it.) This has been working pretty well, but I&#8217;ve been trying to improve my communication skills since that&#8217;s been a little &#8230; <a href="http://davidhogue.com/blog/2011/10/on-working-remotely-and-practicing-writing-skills/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a decent amount of work outside the office recently (or telecommuting as they used to call it.) This has been working pretty well, but I&#8217;ve been trying to improve my communication skills since that&#8217;s been a little more difficult.</p>
<p>That&#8217;s a good chunk of the reason I started my original blog: to get practice writing. I figured I&#8217;d never get better without practice, and practicing in public certainly makes me more careful about what I write and how sloppy I let my writing get.</p>
<p>I&#8217;ve been writing emails more since I&#8217;m not getting as much face-to-face communication. I&#8217;ve noticed it&#8217;s almost more about what I don&#8217;t write than what I do write. I&#8217;ve written giant wall of text emails before, and I think that caused people to just skim it. It takes a lot of work to write a good email that will get your ideas across and get people to respond with what you want.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/RxKvnrP64rQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/10/on-working-remotely-and-practicing-writing-skills/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/10/on-working-remotely-and-practicing-writing-skills/</feedburner:origLink></item>
		<item>
		<title>Blog Redesign</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/eEO3Ptkf_Jw/</link>
		<comments>http://davidhogue.com/blog/2011/10/blog-redesign/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 21:07:06 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=106</guid>
		<description><![CDATA[I&#8217;m updating the design of this place so it doesn&#8217;t have the stock WordPress theme going on anymore. It was a decent enough look, but I wanted something that was mine. I&#8217;m no designer and I know I could find &#8230; <a href="http://davidhogue.com/blog/2011/10/blog-redesign/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m updating the design of this place so it doesn&#8217;t have the stock WordPress theme going on anymore. It was a decent enough look, but I wanted something that was mine.</p>
<p>I&#8217;m no designer and I know I could find someone more talented to do this kind of thing, but this isn&#8217;t exactly a commercial site. I&#8217;ll probably keep tweaking the look a bit to make it a little better, but I want to stick with something that looks kind of like this.</p>
<p>Someday soon, I&#8217;m going to try to move my old content over to this blog.</p>
<p>Then I&#8217;ll have to actually spend time writing some content instead of distracting myself with technical things to tweak.</p>
<p>Oh, and the redesign looks decent on a mobile browser. Or at least it&#8217;s pretty usable.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/eEO3Ptkf_Jw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/10/blog-redesign/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/10/blog-redesign/</feedburner:origLink></item>
		<item>
		<title>Stupid Router Tricks (or how to use DD-WRT to extend the range of a network)</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/0klWDnFwYf4/</link>
		<comments>http://davidhogue.com/blog/2011/10/stupid-router-tricks-or-how-to-use-dd-wrt-to-extend-the-range-of-a-network/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 16:31:33 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[routers]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=97</guid>
		<description><![CDATA[I recently found myself in a situation where I had no direct internet connection where I was staying. I did find a public wifi signal, but it was very weak. At first I tried sitting over on the side of &#8230; <a href="http://davidhogue.com/blog/2011/10/stupid-router-tricks-or-how-to-use-dd-wrt-to-extend-the-range-of-a-network/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently found myself in a situation where I had no direct internet connection where I was staying. I did find a public wifi signal, but it was very weak.</p>
<p>At first I tried sitting over on the side of the room near the window and raising my laptop up higher to get a better signal. Even with that, the signal was still barely usable. It might have worked for sending an email or loading a single web page, but I needed to get some real work done.</p>
<p>After fighting with it for a while, it occurred to me that I had an old wifi router with me. A good old Linksys WRT54-GL.</p>
<p>Originally I had Tomato on it, so I connected it to my laptop with an ethernet cable and got to work. I was able to get it to find the network and connect. Now I could put the router in the top corner of the window where the signal was best and run a wire over to my laptop.</p>
<p>Being hardwired worked, but it still wasn&#8217;t ideal. So I got to wondering if I could simply extend the range of the network. To make a long story short, I couldn&#8217;t figure out how to do it with Tomato. There is a way, but you need to setup both routers to get it to work.</p>
<p>So I installed DD-WRT. It has a feature I&#8217;ve never seen on any other router: it supports virtual wireless interfaces. This meant I could have it connect to the public wifi while at the same time being another access point.</p>
<p>So I set it up to repeater mode, gave it everything it needed to connect to the wifi signal, and added a virtual interface:</p>
<p><a href="http://davidhogue.com/wp-uploads/2011/10/Wifi-Repeater.png"><img src="http://davidhogue.com/wp-uploads/2011/10/Wifi-Repeater.png" alt="" title="Wifi-Repeater" width="806" height="593" class="alignnone size-full wp-image-98" /></a></p>
<p>Before I was done, I wanted to go and setup some security. It was nice I could do this separately for each interface:</p>
<p><a href="http://davidhogue.com/wp-uploads/2011/10/Wifi-Repeater-Security.png"><img src="http://davidhogue.com/wp-uploads/2011/10/Wifi-Repeater-Security.png" alt="" title="Wifi-Repeater-Security" width="806" height="610" class="alignnone size-full wp-image-99" /></a></p>
<p>After doing all this and rebooting a few times, it worked! I had a router that would essentially use a hotspot as a wan port. It was a little finicky at first, but once it started working it was rock solid.</p>
<p>I was still able to setup my own network, run a DHCP server, and do everything else like normal. The router would NAT everything to the hotspot as if it were my ISP. I&#8217;m assuming that the hotspot was also running it&#8217;s own NAT as well, but that didn&#8217;t matter to me.</p>
<p>After I got all that to work, I setup a VPN and tunneled all my traffic through it. Just in case someone malicious was also using the hotspot. It also opened up a lot of possibilities for me like forwarding a port on a public IP back to me or someday running IPv6.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/0klWDnFwYf4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/10/stupid-router-tricks-or-how-to-use-dd-wrt-to-extend-the-range-of-a-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/10/stupid-router-tricks-or-how-to-use-dd-wrt-to-extend-the-range-of-a-network/</feedburner:origLink></item>
		<item>
		<title>Reconfiguring the load balancer to check via HTTP</title>
		<link>http://feeds.davidhogue.com/~r/DavidHogue/~3/Va6B8OswBmU/</link>
		<comments>http://davidhogue.com/blog/2011/10/reconfiguring-the-load-balancer-to-check-via-http/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 22:48:00 +0000</pubDate>
		<dc:creator>David Hogue</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[load balancing]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://davidhogue.com/blog/?p=91</guid>
		<description><![CDATA[So this comes from a work experience. For a project, I was looking into reconfiguring the load balancer we were using&#8230; We&#8217;re using loadbalancer.org. Which uses Linux-HA which uses ldirectord to monitor servers. There are a few options for how &#8230; <a href="http://davidhogue.com/blog/2011/10/reconfiguring-the-load-balancer-to-check-via-http/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So this comes from a work experience. For a project, I was looking into reconfiguring the load balancer we were using&#8230;</p>
<p>We&#8217;re using <a href="http://loadbalancer.org/">loadbalancer.org</a>. Which uses <a href="http://www.linux-ha.org/wiki/Main_Page">Linux-HA</a> which uses <a href="http://linux.die.net/man/8/ldirectord">ldirectord</a> to monitor servers.</p>
<p>There are a few options for how it tests to see if a server is down. We had been using connect. What that does is it just opens a TCP connection on port 80. If it opens successfully, it assumes the server is alive. The problem with that was that the app pool was stopped, but other app pools were still running so IIS was still accepting TCP connections. </p>
<p>What I want to do is change it to negotiate. What negotiate does is it sends an HTTP request and expects to get specific content back.</p>
<p>I tried negotiate last week on QA servers, and it immediately marked every server as unavailable. Not a good sign. What I finally realized is that it&#8217;s sending the HTTP request to the server&#8217;s primary IP and not the load balanced IP. As soon as I made the IIS web accept connections on that IP, it worked as advertised.</p>
<p>I&#8217;ve setup the web on our QA servers to accept connections on port 3333 with a specific host header. That way the load balancer can check if the app pool is running and the file can be stored in our project, but it&#8217;s unlikely someone will accidentally browse to it. (I&#8217;m thinking about reversing this decision for production honestly.)</p>
<p><a href="http://davidhogue.com/wp-uploads/2011/10/Load-balancer-settings.png"><img src="http://davidhogue.com/wp-uploads/2011/10/Load-balancer-settings.png" alt="" title="Load balancer settings" width="373" height="301" class="alignnone size-full wp-image-92" /></a></p>
<p>After I made the changes to QA, I tried stopping app pools and causing crashes by changing the version of asp.net used. I never got any errors in my browser and the server was marked as non-nactive.</p>
<p><a href="http://davidhogue.com/wp-uploads/2011/10/Load-balancer-status.png"><img src="http://davidhogue.com/wp-uploads/2011/10/Load-balancer-status.png" alt="" title="Load balancer status" width="599" height="139" class="alignnone size-full wp-image-93" /></a></p>
<p>This could use a little more testing, but I think it&#8217;s a good solution.</p>
<img src="http://feeds.feedburner.com/~r/DavidHogue/~4/Va6B8OswBmU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://davidhogue.com/blog/2011/10/reconfiguring-the-load-balancer-to-check-via-http/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://davidhogue.com/blog/2011/10/reconfiguring-the-load-balancer-to-check-via-http/</feedburner:origLink></item>
	</channel>
</rss>

