SQL Server等待事件—PAGEIOLATCH_EX

什么是pageiolatch_ex等待事件? 下面我们将对pageiolatch_ex等待事件的相关资料做一个简单的归纳、整理。关于pageiolatch_ex,官方文档的简单介绍如下:

 

pageiolatch_ex

 

occurs when a task is waiting on a latch for a buffer that is in an i/o request. the latch request is in exclusive mode. long waits may indicate problems with the disk subsystem.

 

  在任务等待 i/o 请求中缓冲区的闩锁时发生。 闩锁请求处于独占模式。 长时间的等待可能指示磁盘子系统出现问题。

 

in sql server, a latch is a short-term lightweight synchronization object.

buffer latches including the pageiolatch_ex wait type are used to synchronize access to buf structures and associated pages in the sql server database. the most frequently occurring buffer latching situation is when serialization is required on a buffer page. these buffer latches are not held for the complete period of the transaction. the pageio latches are a subset of buf latches used when the buffer and associated data page or the index page is in the middle of an io operation. pageiolatch wait types are used for disk-to-memory transfers.

 

 

sql server中,闩锁是短暂的轻量级同步对象。

缓冲区闩锁(包括pageiolatch_ex等待类型用于同步访问sql server 数据库中的 buf 结构和关联页。最常见的缓冲区闩锁情况是在缓冲区页面上需要序列化操作时。这些缓冲区闩锁不会在事务的整个期间内保持不变。pageio闩锁是缓冲区和相关数据页或索引页处于 io 操作中间时使用的 buf闩锁的子集。pageiolatch 等待类型用于磁盘到内存的传输。

 

 

pageiolatch_ex (exclusive mode page io latch request)

 

when a sql server user needs a page that is not in buffer cache, the database must first allocate a buffer page, and then puts an exclusive pageiolatch_ex latch on the buffer while the page is transferred from disk to cache. during this operation sql server puts a pageiolatch_ex request on the buffer on behalf of the user. after the write to cache is complete, the pageiolatch_ex latch is released.

 

 

sql server用户需要不在缓冲区高速缓存中的相关页面时,数据库必须首先分配一个缓冲区页面,然后在页面从磁盘传输到高速缓存时,在缓冲区上放置一个独占pageiolatch_ex闩锁。 在此操作过程中,sql server 代表用户在缓冲区上发出pageiolatch_ex请求。写入高速缓存完成后,将释放pageiolatch_ex闩锁。

 

 

problem indication

 

excessive pageiolatch_ex waits occur when data is transfered from disk to memory for update operations and these transfers take time to complete.

this may be an indication of disk contention or other disk subsystem bottlenecks.

 

当数据从磁盘传输到内存中以进行更新操作时,将出现大量的pageiolatch_ex等待,并且这些传输(磁盘io操作)需要时间才能完成。这可能表明存在磁盘争用或其他磁盘子系统瓶颈

 

ps:其实当一个大表发生大量数据删除操作时,也会出现大量的pageiolatch_ex等待事件。

 

 

 

description:

 

this wait type is when a thread is waiting for the read of a data file page from disk to complete, and the thread is going to modify the page structure once it is in memory (ex = exclusive mode). the latches whitepaper in the sidebar on the right has a description of all latch modes and their compatibility with other latch modes.

(books online description: “occurs when a task is waiting on a latch for a buffer that is in an i/o request. the latch request is in exclusive mode. long waits may indicate problems with the disk subsystem.”)

 

这种等待类型是线程正在等待从磁盘读取数据文件的相关页面到内存的完成,并且一旦线程将修改内存中的页面结构(ex = exclusive模式)。 右侧边栏中的闩锁白皮书介绍了所有闩锁模式及其与其他闩锁模式的兼容性。

(在线丛书描述:当任务正在等待i / o请求中的缓冲区的闩锁上时发生。闩锁请求处于互斥模式。长时间等待可能表明磁盘子系统有问题。

 

 

 

 

pageiolatch_ex

 

a query is waiting for exclusive write access to a page in order to add data to the page, but the page is not currently in memory and has to be loaded from disk.

 

page latches are lightweight, non-configurable locks used by internal processes within sql server to manage access to the page buffer in memory.  when sql server has to read pages from the disk into the memory buffer or from the buffer out to disk, it must place latches on the buffer pages while the processes take place.

it’s normal to see some pageiolatch_* waits, but if you’re frequently seeing them with wait times consistently above 10 milliseconds and you’re experiencing some type of latency, it suggests that the i/o subsystem is under pressure. conversely, if you see many brief waits, you may be affected by increased i/o activity.

 

 

查询正在等待对页面的独占写入访问,以便将数据添加到页面,但是该页面当前不在内存中,必须从磁盘加载。

 

闩锁是sql server 内部进程用于管理对内存中页面缓冲区的访问的轻量级、不可配置的锁。当sql server必须将磁盘中的页面读取到内存缓冲区中或从缓冲区中读取到磁盘时,它必须在进程进行时将闩锁放在缓冲区页面上。

看到一些pageiolatch_ *等待是很正常的,但是如果您经常看到它们的等待时间始终超过10毫秒,并且遇到某种类型的延迟,则表明i/o子系统面临压力。 相反,如果您看到许多短暂的等待,则可能会受到i/o活动增加的影响。

 

 

 

 

参考资料:

 

https://logicalread.com/2012/11/12/sql-server-pageiolatch_ex-wait-type/#.xkh2kcizahs

https://www.sqlskills.com/help/waits/pageiolatch_ex/

https://docs.microsoft.com/zh-cn/sql/relational-databases/system-dynamic-management-views/sys-dm-os-wait-stats-transact-sql?redirectedfrom=msdn&view=sql-server-ver15

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐