日期:2014-05-17  浏览次数:21216 次

进程一直阻塞,等待资源为:LOG_MANAGER,引起的可能原因是什么?
大家好。

我有个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到底是什么,查了google与度娘也没找到答案。我对SQL Server不是那么精通,这个问题困扰好久了,请大家帮忙分析下可能的原因是什么。如果还需要我提供其他数据的话,我会及时跟帖的。

多谢啦!

------解决方案--------------------
LATCH_EX 

引用:
应该是在latch log文件时候出现的等待。看一下sql log。尝试降低log文件autogrow值,并且进行常规的log备份避免log物理大小增长。


同意。下面是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.