Thursday, January 24, 2013

How to improve CRMAsyncService.exe memory and CPU usage.


The Microsoft CRM web site if hosted on a multi-processor/core server will automatically be using server Garbage Collection mode, but for managed Microsoft .Net programs like the CRMAsyncService.exe, they will default to the workstation garbage collection mode. Note that this resolution will only apply if Microsoft Dynamics CRM is installed on a multi-processor or multi-core server since the crmasyncservice will aways be forced to use the Microsoft .Net workstation garbage collection mode on a single CPU (non multi-core) server.

In order to allow the CRMAsyncService.exe to take advantage of all the processors/cores on a server, you can add the following element to a CRMAsyncService.exe.config file and place it in the same directory as the CRMAsyncService.exe program, typically in the “C:\Program Files\Microsoft Dynamics CRM\Server\bin” directory if you haven’t changed the default installation location for the Microsoft CRM Server.

Note that these changes will take effect the next time that you restart the Microsoft CRM Async Service.  Also note that if you already have a crmasyncservice.exe.config file, to place this information for the <gcServer enabled=”true”/> into the Runtime and configuration tags as seen below.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <runtime>
      <gcServer enabled="true"/>
   </runtime>
</configuration>

As with any changes, although this can give much better throughput for the Microsoft CRM Async Service and workflows able to be executed in a given time frame, it is best to measure the changes before and after implementing this change.  The CRM Async Service perfmon counters can be used for this as well as counters for Memory, .Net CLR Memory, and Processor.  There are also other factors such as customizations, workflows, and SQL Server performance that plays a factor in overall Microsoft CRM Async Service performance, but enabling gcServer mode is a great way to improve performance on multi-processor servers with minimal effort.