1 / 9

Buffer cache 동작원리 (select)

Buffer cache 동작원리 (select). 3. 실행 계획 생성. Select 4,5,6,7,8 from sj. 7. 결과 전송. client. Server process. 1. SQL 요청. Library cache. 4. Block 탐색. 6. Block 읽음. Row cache. Datafile. 5. Block 로드 (I/O 발생 ). 2. 구문 검사 , 문법 검사. 8. SGA 에 있는 cache 된 Data 블록을 찾을때 획득하는 래치.

Download Presentation

Buffer cache 동작원리 (select)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Buffer cache 동작원리(select) 3. 실행 계획 생성 Select 4,5,6,7,8 from sj 7. 결과 전송 client Server process 1. SQL 요청 Library cache 4. Block 탐색 6. Block 읽음 Row cache Datafile 5. Block 로드 (I/O 발생) 2. 구문 검사, 문법 검사 8

  2. SGA 에 있는 cache 된 Data 블록을 찾을때 획득하는 래치 #LRU list main : 사용된 buffer들이 대한 list(used list). touch count 알고리즘을 쓰기 때문에 hot영역과 cold 영역으로 나뉜다. sub : free buffer list. 먼저 확인하는 부분. 확인이 안되면 main으로 올라가서 lru end에 저장 # LRUW list(dirty list) main : 변경된 buffer list. sub : 현재 dbwn에 의해 기록중인 buffer list Hash chain 하나의 해쉬버켓에 연결된 Header의 집합 Bucket 해쉬함수를 통해 그룹핑된 헤더목록을 관리 LATCH 1 B.H B.H B.H bucket B.H B.H B.H bucket B.H B.H B.H bucket • Buffer header • Data buffer, cache buffer chain latch • hash chain • LRU cahin의 정보 • 실제버퍼캐쉬의 포인터 정보 LATCH 2 B.H B.H B.H bucket B.H B.H B.H bucket B.H B.H B.H bucket Work set LRU LRUW

  3. 사용자가 요청한 블록의 DBA와 클래스에 대해 해시 함수를 이용해서 해쉬 값을 생성하고, 해시 값에 해당하는 버킷을 찾는다 *요기서 버퍼락을획득하는과정에서 경합이 생기면 buffer busy wait 이벤트로대기 LATCH 1 4. Buffer를 사용하기 위한 buffer lock 획득 3. 해당버퍼가 존재하는 해쉬체인을 탐색 B.H B.H B.H bucket B.H B.H B.H bucket B.H B.H B.H 2. Cache buffer chain latch 획득 bucket 5. Cache buffer lru chain latch 획득 LATCH 2 B.H B.H B.H bucket B.H B.H B.H bucket B.H B.H B.H 프리블럭이 있으면, 데이터파일에서 해당블록을 해당 버퍼로 읽이들인다 bucket 만약 버퍼캐쉬블럭에 존재하지않으면work set 을 관리하는 cache buffers lru latch를 획득,경합이 발생하면! 보조리스트를 통해 프리버퍼가 있는지 찾는다 Work set LRU LRUW 더티버퍼 확인

  4. COLD : 사용빈도가 낮은 블럭 HOT : 사용 빈도가 높은 블럭 인영의 touch count는 0으로 초기화 나 머리 나 꼬리 MRU (HOT) 나 머리 LRU (COLD) 해더위치로위치 버퍼캐쉬에머무를확률이높아진다. 프리리스트를 찾는 중 꼬리에 Touch count 가 1 이하인 신애가 있으면 FREE Buffer로 사용 꼬리로 위치 버퍼캐쉬에머무를확률이 낮아진다. (인덱스 풀스캔/ 테이블풀스켄) MID POINT 프리리스트를 찾는 중 꼬리에 Touch count 가 2 이상인 인영이가 있으면 Hot 영역의 해더로 이동 삽입 Touch count :1 세팅 Lru보조리스트에서 프리공간이 비어있으면 메인리스트의 콜드영역 꼬리에서부터 찾는다 삽입 LRU LIST 싱글I/O 에 의해 읽혀진 블록 더블 I/O 에 의해 읽혀진 블록

  5. Session 이나 call 동안에만 객체저장 Session 이 금방 끊어질수있어 사용할 대상이 아님 영구적인 객체를 저장 , 사용 할수없다 즉시 사용 가능 (freelist에서 관리) Linked list 구조 재생성이가능한 상태 (lru list 에서 관리) Large chunk 를 위해 할당된 공간 Parameter를 설정해주지 않았다면 Shared pool의 5% 가 default로 갖는다

  6. A,B user 각각 Select * from emp; 라는 쿼리를 전송했을 경우 이런 구조가 된다 그래서 dependency table에는 A 의 경우 a.emp table의 LCO를 참조 B의 경우 b.emp table의 LCO를 참조 이 참조 과정에서 handle의 lock hold/wait list, pin hold/wait list를 이용하게 된다

More Related