Configuring Garbage Collection on the Server

Managed code applications that use Lync Server Application API receive significant benefits from using the server-optimized garbage collector (GC) instead of the default workstation GC.

Workstation is the default GC mode and the only one available on single-processor computers. Workstation GC is hosted in console and Windows Forms applications. It performs full (generation 2) collections concurrently with the running program, thereby minimizing latency. This mode is useful for client applications, where perceived performance is usually more important than raw throughput.

The server GC is available only on multiprocessor computers. It creates a separate managed heap and thread for each processor and performs collections in parallel. During collection, all managed threads are paused (threads running native code are paused only when the native call returns). In this way, the server GC mode maximizes throughput (the number of requests per second) and improves performance as the number of processors increases. Computers with four or more processors offer enhanced performance. All managed code applications using Lync Server Application API should use the server GC.

Using Microsoft .NET Framework 2.0, you can run server GC in a non-hosted managed application by adding the following element to the application's configuration file:

  Copy imageCopy Code
<configuration
   <runtime>
	<gcServer enabled="true"/>
   </runtime>
</configuration>
NoteNote

When you set the <gcServer/> element to "true", the <gcConcurrent/> element (the Workstation GC default) is disabled.

Make sure to name the configuration file using the format MyApp.exe.config and to save it in the same directory as MyApp.exe.