Optimizing Microsoft SQL Server inside a Virtual Machine

Microsoft SQL Servers are designed to run a timer in 1ms intervals for precise timekeeping. Unfortunately, tight timers inside virtual machines generate a lot of context switches due to threads having to be awoken in very short intervals. The consequence thereof is that a virtual machine may start to consume a large CPU slice.

The -T 8038 MSSQL trace flag disables the 1ms interval timer thereby preventing the CPU consumption inside a virtual machine. The trace flag must be added as a startup parameter to MSSQL.