본문 바로가기

Advanced MySQL

7. PlanetMySQL Blog: Does the insert buffer work?


The insert buffer in InnoDB buffers pending inserts for secondary index pages to avoid blocking on disk reads for those pages during secondary index maintenance.
This feature has been renamed the change buffer for InnoDB in MySQL 5.5 as it has been enhanced to support more than inserts.

InnoDB에 insert buffer는 secondary index pages에 insert들이 발생하는 동안  디스크로의 읽기를 피하며 작업이 차단하지 않도록 secondary index를 유지합니다.
이 기능의 이름은 insert에 보다 많은 지원을 하도록 향상하기 위해 change buffer로 MySQL 5.5에서 변경되었다.

It works for me. But talk is cheap so I will provide a few numbers.
You can confirm that it works in theory by running the insert benchmark with change/insert buffering enabled and disabled.
Compare the results. I will do this myself today.

그것은 저희를 위해 작동합니다. 몇 가지 가벼운 숫자들을 제공 하겠습니다.
당신은 change/insert buffering이 활성화 / 비활성화 일때의 insert의 기준에 대한 이론을 확인 할 수 있습니다.
결과들에 대한 비교를 오늘 할 것입니다.
 
I can confirm that it works in practice by reviewing the output from SHOW INNODB STATUS.
There is a section with a few insert buffer statistics.
User sessions write entries to the insert buffer during secondary index maintenance when the leaf page to be updated is not in the buffer pool.
A background thread reads leaf pages from disk to apply pending changes buffered in the insert buffer.
he insert buffer is a b-tree protected by transactions that uses the space_id and block_id values for secondary index leaf pages as a key.

나는 SHOW INNODB STATUS의 출력을 검토하여 확인 합니다.
여기에는 몇가지 insert buffer의 통계 섹션이 있습니다.
사용자 세션은 secondary index의 maintenance중 리프 페이지가 버퍼 풀에 없는 업데이트를 해야 할 때 
insert buffer에 항목을 작성합니다.
백그라운드 스레드가  leaf 페이지를  디스크로 부터 읽습니다. 
insert buffer에 버퍼상에 변경중인  내용을 적용 하기 위해서.
 insert buffer의 트랜잭션은 키로 보조 인덱스 잎 페이지의 space_id과 block_id 값을 사용하여  
B-tree로 보호됩니다.   
SHOW INNODB STATUS has values for:

■ inserts - the number of changes written to the insert buffer
■ merged recs - the number of changes flushed from the insert buffer to disk
■ merges - the number of disk reads done to flush changes from the insert buffer to disk

INNODB 상태 값 :

inserts -  insert buffer에 변화된 기록의 수
merged recs - insert buffer에서 디스크로 변경된 flushed된 수
merges - 디스크에서 읽기 완료된 insert buffer의 변경된 flushed 수

You can estimate the benefit from the insert buffer as the ratio: 1 - (merges / merged_recs).
This is an estimate of the fraction of secondary index maintenance disk reads saved by using the insert buffer.
For the example below the result is 0.62 and the insert buffer reduces reads by 62%.
I checked another server and it reduced reads by 65%.

당신은 비율로 insert buffer에서의 이익을 예측할 수 있습니다: 1 - (merges / merged_recs).
이것은 secondary index 유지 보수 디스크의 분율의 예상은 insert buffer를 사용하여 저장 읽고 있습니다.
그 결과 아래의 예를 들면  0.62의 insert buffer는 읽기를 62%까지 줄일 수 읽습니다.
다른 서버를 체크하니 65 %로 감소하여 읽습니다.

An example of the output:

INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
...
149451588 inserts, 147593778 merged recs, 55607567 merges

참고 : http://www.facebook.com/note.php?note_id=460565850932