Archives For Emulator

Releasing Memory Pressure

Traditionally, in .NET applications we adjust the Garbage Collector to operate in server mode by modifying the App.config or Web.config files. However, Worker Roles work differently because your code is actually hosted by the WaWorkerHost.exe process. So you must modify the WaWorkerHost.exe.config file instead of app.config and web.config.

This article covers the Worker Role. However, the same concepts and techniques may be used to change the Web Roles mode by changing WaWebHost.exe.config instead of WaWorkerHost.exe.config.

WaWorkerHost.exe.config is in %approot%\base\x64

What is ServerGC & Why is it Important?

The Server Garbage Collection process allows us to reclaims objects that are no longer being used, clears memory, and makes it available for future allocations. In contrast to the Work Station Garbage Collector mode, the Server Garbage Collection mode aggressively releases memory and can prevent your roles from running out of memory due to memory bloat.

Reducing memory bloat allows us to increased density, which typically reduces overall operational costs in a pay for what you consume environment. Furthermore, Background Server Garbage Collection can increase performance.

Conditions for a Garbage Collection Include

  • The system has low physical memory.
  • The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This threshold is continuously adjusted as the process runs.
  • The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.

Continue Reading…

download Today I came across the ConfigStoreException. My Worker Roles were constantly being recycled by Windows Azure and I wasn’t able to use the remote debugger to get at any information. (Using Windows Azure SDK 2.2)

To be fair, the Worker Roles ran fine on my local Windows Azure Emulator. As you can imagine, I was completely baffled by all this… So I decided to check if Windows Azure Diagnostics was able to log anything. Fortunately, I was able to get two exceptions. (The exceptions were found in the WADWindowsEventLogsTable located in the Windows Azure Storage Account used for your Windows Azure Diagnostics)

Continue Reading…