InnoDB uses simulated asynchronous disk I/O: InnoDB creates a number of threads to take care of I/O operations, such as read-ahead.

There are two read-ahead heuristics in InnoDB:

  • In sequential read-ahead, if InnoDB notices that the access pattern to a segment in the tablespace is sequential, it posts in advance a batch of reads of database pages to the I/O system.

  • In random read-ahead, if InnoDB notices that some area in a tablespace seems to be in the process of being fully read into the buffer pool, it posts the remaining reads to the I/O system.

InnoDB uses a novel file flush technique called doublewrite. It adds safety to recovery following an operating system crash or a power outage, and improves performance on most varieties of Unix by reducing the need for fsync() operations.

Doublewrite means that before writing pages to a data file, InnoDB first writes them to a contiguous tablespace area called the doublewrite buffer. Only after the write and the flush to the doublewrite buffer has completed does InnoDB write the pages to their proper positions in the data file. If the operating system crashes in the middle of a page write, InnoDB can later find a good copy of the page from the doublewrite buffer during recovery.

원문 : http://www.mysqlkorea.co.kr/sub.html?mcode=develop&scode=01&m_no=20752&cat1=14&cat2=422&cat3=448&lang=e

InnoDB의 버퍼를 공부하다 보니 DoubleWrite Buffer에 대해서 나오길래 찾다가 MySql 홈페이지에서 찾았다.

InnoDB는 시뮬레이티드 비동기 (simulated asynchronous) 디스크 I/O를 사용한다: InnoDB는 읽기-위주 (read-ahead)와 같은 I/O 연산을 잘 처리하기 위해 수많은 쓰레드를 생성한다.

 

InnoDB에는 두 가지의 읽기-위주 방법이 존재한다:

  • 시퀀셜 읽기-위주의 경우, InnoDB가 테이블스페이스에 있는 세그먼트에 대한 접속 패턴이 시퀀셜이라는 것을 인지한다면, 앞에 존재하는 데이터베이스 페이지의 읽기 배치 연산을 I/O시스템에 보낸다.
  • 무작위 읽기-위주의 경우, 만일 InnoDB가 테이블스페이스의 어떤 부분이 버퍼 풀 안으로 전체적인 읽기를 진행하는 것처럼 인지한다면, 나머지 읽기 연산을 I/O 시스템에 보낸다.

InnoDBdoublewrite라고 불리우는 기발한 파일 플러시 기법 (novel file flush technique)을 사용한다. 이 기법은 OS 크래시 또는 전원 문제 이후의 복구 연산을 보다 안전하게 하도록 하며, fsync() 연산에 대한 필요성을 절감시킴으로써 다양한 유닉스 버전의 성능을 향상시켜준다.

 

이중 쓰기란, 데이터 파일에 페이지를 쓰기 전에, InnoDB는 우선 페이지를 이중 쓰기 버퍼라고 불리우는 인접한 테이블스페이스에 기록한다는 것을 의미한다. 이중 쓰기 버퍼에 기록을 하고 이것을 플러시한 후에야 InnoDB는 그 페이지를 데이터 파일의 적당한 위치에 기록을 하게 된다. 만일 OS가 페이지 쓰기 중간에 크래시 된다면, InnoDB는 나중을 복구를 할 때 이중 쓰기 버퍼에서 제대로 된 페이지를 찾을 수가 있게 된다.



이는 한글 메뉴얼 site에서 번역본을 찾은 것이며, 조금 번역이 잘못된 것을 고쳐 보았다.


다음은 조금 이해하기 어려운 용어를 정리해 보았다. 도움이 되길...

* 읽기-위주 (read-ahead)
  - 딱히 번역할 말을 나도 찾지 못하겠다. 쩌비.
    우선, read-ahead란 일반적으로 데이터는 연속된 공간에 순차적으로 저장되어지는 점(locality)을 모태로 읽기 연산이 발행하면, 특정한 몇몇 페이지(단지 읽기의 단위를 표현하고 싶었다.)를 미리 같이 읽어 버리는 기법을 말한다. 즉, 여기에서는 버퍼에 7번 페이지를 읽어달라고 요청이 오면, 8번 페이지도 곧 읽기 요청이 올것이라고 예상하고, 미리 7번 8번 페이지를 같이 읽어들이는 기법을 말한다.
    이는, 8번이 될 수도 있고, 8~n번 페이지를 모두 동시에 읽을 수도 있으며, 이는 여러 알고리즘 기법에 따라 다르다.
    그리고, 꼭 8번이 되지 않을 수도 있으며, 임의(random)의 한 페이지을 미리 읽는 기법도 있으니, 참고하기 바란다. (위에 보니 나와있다... 헐... 미리 다 읽고 써야겠다.)

+ Recent posts