I stumbled on a script at https://gallery.technet.microsoft.com/office/Exchange-2013-Performance-23bcca58, referenced by https://blogs.technet.microsoft.com/rmilne/2015/04/06/exchange-2013-performance-health-check-script/.
Ran the script on an Exchange 2013 system, and among others, it threw an error for the MSExchangeMapiFrontEndAppPool using Workstation garbage collection mode instead of Server mode:
Not being a .Net developer, looked up the issue, and all sources that I could find indicated that the garbage collection should be configured for Server mode for improved performance. Just as the script said.
I was (and still am) gobsmacked as to why the Exchange team chose this mode while everything else is optimised to the extreme.
The script is great, kudos for Marc Nivens, except it doesn't provide any reference as to how to go about changing the garbage collection mode, which would be very helpful for folk like me who aren't developers.
So here is how to do it:
First, we need to find where garbage collection is configured. For that we need to identify the configuration file for the .Net application. There are a number of ways, two of which are shown below:
1. The DOS way:
1 | %WINDIR%\System32\Inetsrv\appcmd list apppool "MSExchangeMapiFrontEndAppPool" /text:"CLRConfigFile" |
1 2 3 | [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration") | Out-Null $serverManager = new-object Microsoft.Web.Administration.ServerManager (($serverManager.ApplicationPools | ?{$_.Name -eq "MSExchangeMapiFrontEndAppPool"}).Attributes | ?{$_.Name -eq "CLRConfigFile"}).Value |
Essentially the file is %ExchangeInstallPath%\bin\MSExchangeMapiFrontEndAppPool_CLRConfig.config
Open the file in an elevated Notepad and change the <gcServer enabled="false" /> line to <gcServer enabled="true" />. Here is the file with the default value:
After the change (and a server restart) I got this status:
A word of caution: When a new CU is installed then it overwrites the config file, thus reverting back the garbage collector to Workstation mode. Don't forget to update the file again after the CU is installed.
Reference: https://msdn.microsoft.com/en-us/library/cc165011(v=office.11).aspx
Happy garbage collecting!