2017. 7. 12. 09:25

‘A time-out occurred while waiting for buffer latch’


출처: https://mssqlwiki.com/tag/a-time-out-occurred-while-waiting-for-buffer-latch/


에러 메시지 :

           A time-out occurred while waiting for buffer latch -- type 2, bp 000000C959C8B640, page 3:1524485, stat 0x40d, database id: 48, allocation unit Id: 536870912/281475513581568, task 0x0000000008059468 : 8, waittime 300 seconds, flags 0x3a, owning task 0x0000000006875468. Not continuing to wait.

 

 

유형

현재 래치 획득 요구의 래치 모드다음 매핑을 사용하는 숫자 값입니다. 0 - NL (사용되지 않음); 1 - KP; 2 - SH; 3 - UP; 4 - EX; 5 - DT.

 

 

이유 :

           We would end up with data or data structure inconsistency. To avoid inconsistency SQL Server uses Synchronization Mechanisms like Locks,Latches and Spinlocks.

 

에러 이후 :  Latch 대기 시간 기다리다가 작업이 중지 됨 (복원,패키지 등. )

5분이상 지속 될 경우 모든 스래드가 포함된 미디 덤프가 발생 한다.

 

 

래치 유형은 sysprocesses 의 대기 유형에서 식별 할 수 있음.

 

PAGEIOLATCH_ * : sysprocesses의이 waittype SQL Server가 버퍼 풀 페이지의 물리적 I / O가 완료 될 때까지 기다리고 있음을 나타냅니다

                                 1. PAGEIOLATCH_ *는 일반적으로 과도한 IO를 수행하는 쿼리를 조정하여 해결됩니다 (보통 물리적 IO의 양을 줄이기 위해 인덱스 (또는) 통계를 추가, 변경 및 제거 함).

                                 2. 디스크 병목 현상이 있는지 확인하고 수정하십시오 (Pageiolatch 대기 시간 (ex> 30 ms)).

 

PAGELATCH_ * : sysprocesses의이 waittype SQL Server가 데이터베이스 페이지에 대한 액세스를 기다리고 있지만 페이지가 실제 IO를 수행하지 않음을 나타냅니다

1.        이 문제는 대개 같은 시간에 동일한 물리적 페이지에 액세스하려고 시도하는 다수의 세션으로 인해 발생합니다우리는 spid의 대기 리소스를 봐야합니다. wait_resource는 페이지 번호입니다 (형식은 dbid : file : pageno).

          액세스 중입니다

2. 우리는 DBCC PAGE를 사용하여 우리가 논쟁의 대상이되는 페이지의 객체 또는 유형을 식별 할 수 있습니다또한 할당, 데이터 또는 텍스트에 대한 경합인지 여부를 결정하는 데 도움이됩니다.

 -> 매번 다르고 디비도 다르고 테이블도 다름.

3.        SQL Server에서 가장 자주 대기하는 페이지가 tempdb 데이터베이스에 있으면 dbid 2의 페이지 번호에 대한 대기 리소스 열을 확인합니다   http://support.microsoft.com 언급 된 tempdb 할당 래치 경합이 발생할 수 있습니다 . / kb / 328551

4. 페이지가 사용자 데이터베이스에 있으면 테이블 끝의 동일한 페이지에 대해 모든 스레드가 경합하는 ID와 같은 단조 키에 클러스터형 인덱스가 있는지 확인하십시오이 경우 우리는 다른 것을 선택해야합니다.

          다른 페이지에 작업을 분산시키기 위해 클러스터 된 인덱스 키.

 

LATCH_ * :    buf 래치 대기는 여러 가지로 인해 발생할 수 있습니다. sysprocesses wait resource 열을 사용하여 관련된 래치 유형을 결정할 수 있습니다 (KB 822101). 

1.        매우 일반적인 LATCH_EX 대기는 프로파일 러 추적 또는 sp_trace_getdata 실행으로 인한 것 입니다자세한 내용은 KB 929728을 참조하십시오 .

2.        자동 성장 및 자동 축소.

 

 

 

 

***********   참고  ***********************

 

Types of the Latch:

Buffer (BUF) Latch

Used to synchronize access to BUF structures and their associated database pages.

 

Buffer “IO” Latch

A subset of BUF latches used when the BUF and associated data/index page is in the middle of an IO operation (Reading page from disk or writing page to disk).

 

Non-Buffer (Non-BUF) Latch

These are latches that are used to synchronize general in-memory data structures generally used by queries/tasks executed by parallel threads, auto grow operations , shrink operations etc. 

 

Latch modes

 

Keep (KP) Latches

Used to ensure that the page is not released from memory while it is in use. 

Shared (SH) Latches

Used for read-only access to data structures and prevent write access by others threads.

This mode allows shared access. 

SH is compatible with KP, SH, and UP.  It should be noted that although in general SH implies read-only access, it is not always the case. For buffer latches SH is the minimum mode required in order to read a data page.

Update (UP) Latches

Allows read access to the data structure(Compatible with SH and KP), but prevents other EX-latch access. 

Used for write operations when torn page detection is off and when AWE is not enabled.

Exclusive (EX) Latches

Prevents any read activity from occurring on the latched structure. EX is only compatible with KP.

Used during read IO during write IO when torn page detection is on or AWE is enabled.

Destroy (DT) Latches

Used when removing BUFs from the buffer pool, either by adding them to the free list or unmapping AWE buffers. 

 

 

Latch compatibility

 

KP

SH

UP

EX

DT

KP

Y

Y

Y

Y

N

SH

Y

Y

Y

N

N

UP

Y

Y

N

N

N

EX

Y

N

N

N

N

DT

N

N

N

N

N


'Error Case' 카테고리의 다른 글

Server Broker Error Case  (0) 2011.03.11
에러::SSIS 연결끊기는 현상  (1) 2010.06.03
에러::Agent  (1) 2010.06.03
에러::64bit 버퍼 풀 페이징  (0) 2010.06.03