我有个ASP.NET网站,用的是SQL Server 2008,系统本身的压力不是很大(每天新增数据十几万条,内存占用率50%左右,CPU占用率10-20%左右),但是每隔几天会出现一次长时间的阻塞,阻塞的语句是不一定的,有时是某些表的update,有时是另外一些表的insert,不过一旦发生阻塞,似乎update与insert语句就都执行不了啦(未经验证),我在活动监视器中查看了长时间阻塞的任务状态为SUSPENDED的进程,等待资源均为LOG_MANAGER,等待类型均为LATCH_EX,工作负荷组均为internal。资源等待一栏处等待类别为Latch、Logging的累计等待时间分别为:12118秒,17985秒。
另外,执行如下查询语句也未能找到原始的阻塞进程:
SELECT blocking_session_id, wait_duration_ms, session_id
FROM sys.dm_os_waiting_tasks
WHERE blocking_session_id IS NOT NULL
同意。下面是LOG_MANAGER的解释:
With this class, it is important to note that it is not used for basic transaction log operations and thus does not affect mainline log throughput. It is, however, used to synchronize log file grow operations. Thus, an option for resolving contention on this latch class is to size the log file appropriately upfront or monitor log file usage and manually grow the file during slow periods.