Geeks With Blogs
Steve Loethen When I grow up I want to code in c#

As we all know as coders, things like logging are never important.  Our code will work right the first time.  So, you can understand my surprise when the first time I deployed the autoscaling worker role to the actual Azure fabric, it did not scale.  I mean, it worked on my machine.  How dare the datacenter argue with that. 

So, how did I track down the problem?  (turns out, it was not so much code as lack of the right certificate)  When I ran it local in the developer fabric, I was able to see a wealth of information.  Lots of periodic status info every time the autoscalar came around to check on my rules and decide to act or not.  But that information was not making it to Azure storage.  The diagnostics were not being transferred to where I could easily see and use them to track down why things were not being cooperative.  After a bit of digging, I discover the problem.  You need to add a bit of extra configuration code to get the correct information stored for you.  I added the following to my app.config:

Code Snippet
  1. <system.diagnostics>
  2.     <sources>
  3.         <source name="Autoscaling General"switchName="SourceSwitch"
  4.           switchType="System.Diagnostics.SourceSwitch" >
  5.         <listeners>
  6.           <add name="AzureDiag" />
  7.             <remove name="Default"/>
  8.         </listeners>
  9.       </source>
  10.         <source name="Autoscaling Updates"switchName="SourceSwitch"
  11.           switchType="System.Diagnostics.SourceSwitch" >
  12.         <listeners>
  13.           <add name="AzureDiag" />
  14.             <remove name="Default"/>
  15.         </listeners>
  16.       </source>
  17.     </sources>
  18.     <switches>
  19.       <add name="SourceSwitch"
  20.           value="Verbose, Information, Warning, Error, Critical" />
  21.     </switches>
  22.     <sharedListeners>
  23.       <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,Microsoft.WindowsAzure.Diagnostics, Version=, Culture=neutral,PublicKeyToken=31bf3856ad364e35" name="AzureDiag"/>
  24.     </sharedListeners>
  25.     <trace>
  26.       <listeners>
  27.         <add
  28.             type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,Microsoft.WindowsAzure.Diagnostics, Version=, Culture=neutral,PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
  29.           <filter type="" />
  30.         </add>
  31.       </listeners>
  32.     </trace>
  33.   </system.diagnostics>

Suddenly all the rich tracing info I needed was filling up my storage account.  After a few cycles of trying to attempting to scale, I identified the cert problem, uploaded a correct certificate, and away it went. 

I hope this was helpful.

Posted on Tuesday, June 26, 2012 10:19 AM | Back to top

Comments on this post: Autoscaling in a modern world…. last chapter

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Steve Loethen | Powered by: