Log semaphore contention and user log caches

In high throughput environments with a large number of concurrent users committing transactions, a certain amount of contention for the log semaphore is expected. In some tests, very high throughput is maintained, even though log semaphore contention is in the range of 20 to 30%.


Preallocating Log Pages to Reduce Contention

In SMP environments with high rates of data modification transactions, use the dbcc tune(log_prealloc) command if log semaphore contention is high. A system task, the log allocator process, performs transaction log allocations, reducing the time that each task holds the log semaphore.

To start the log allocator process for a database, use:

dbcc tune(log_prealloc, dbid, "on")

The log allocator loops through databases in a way similar to the checkpoint process, except that a System Administrator chooses which databases need log pre allocation. The log allocator runs once per minute.

When the log allocator is enabled for a database, it preallocates 64 log pages at a time.

Some options for reducing log semaphore contention are: