MySQL의 InnoDB의 스토리지 엔진의 핵심 기능

버퍼 풀 관련

select @@innodb_buffer_pool_size;
+---------------------------+
| @@innodb_buffer_pool_size |
+---------------------------+
|                1073741824 |
+---------------------------+

select 1073741824/1024/1024;
+----------------------+
| 1073741824/1024/1024 |
+----------------------+
|        1024.00000000 |
+----------------------+

# innodb_buffer_pool_size 一般建议最多是物理内存的 75-80%

에서 innodb_flush_log_at_trx_commit (한 이중 표준)

주제어 이노 데이터 로그 버퍼는 각각 디스크 플러시 점 0,1,2 세 값의 로그 파일에 기록된다.

select @@innodb_flush_log_at_trx_commit;
+----------------------------------+
| @@innodb_flush_log_at_trx_commit |
+----------------------------------+
|                                1 |
+----------------------------------+
参数说明:

1,每次事物的提交都会引起日志文件写入、flush 磁盘的操作,确保了事务的ACID;flush 到操作系统的文件系统缓存 fsync到物理磁盘.
0,表示当事务提交时,不做日志写入操作,而是每秒钟将 log buffer 中的数据写入文件系统缓存并且秒 fsync 磁盘一次;
2,每次事务提交引起写入文件系统缓存,但每秒钟完成一次fsync磁盘操作。
--------
The default setting of 1 is required for full ACID compliance. Logs are written and flushed to disk at each transaction commit.
With a setting of 0, logs are written and flushed to disk once per second. Transactions for which logs have not been flushed can be lost in a crash.
With a setting of 2, logs are written after each transaction commit and flushed to disk once per second. Transactions for which logs have not been flushed can be lost in a crash.
-------

innodb_flush_method를 = (O_DIRECT,를 fdatasync)


HTTPS : 공식 문서를 참조 할 것은 //dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_flush_method
점멸이 옵션 제어를 로그 버퍼와 데이터 버퍼를 할 때 파일 시스템 캐시 여부를 통해 디스크

현상 유지 전략을 확인

show variables like '%innodb_flush%';

# 参数说明
O_DIRECT  : 数据缓冲区写磁盘,不走 OS buffer
fsync     : 日志和数据缓冲区写磁盘,都走 OS buffer
O_DSYNC   : 日志缓冲区写磁盘,不走 OS buffer

권장 사항

最高安全模式:
innodb_flush_log_at_trx_commit=1
Innodb_flush_method=O_DIRECT
最高性能:
innodb_flush_log_at_trx_commit=0
Innodb_flush_method=fsync

추천

출처www.cnblogs.com/klvchen/p/12305251.html