重要参数
innodb_flush_log_at_trx_commit:用来控制redo log刷新到磁盘的策略。
=1 每次先刷到文件系统os buffer 直接调用fsnyc()写到磁盘上的 redo log
=2 刷到文件系统os buffer 等master线程隔1秒调用fsnyc()写到redo log 这个可以通过参数设置
=0 啥也不干 就放在redo buffer 等系统master线程写到os buffer 然后在写到redo log (这个不考虑使用)
Write and flush the logs every N seconds. innodb_flush_log_at_timeout allows the timeout period between flushes to be increased in order to reduce flushing and avoid impacting performance of binary log group commit. The default setting for innodb_flush_log_at_timeout is once per second.
也就是说 比如设置innodb_flush_log_at_timeout=10 超过10秒 就会调用fsync() 当设置为0和2的时候
设置的就是master 线程 对sync 日志 刷新时间
实际储存数据真正落地到磁盘上 下面3种来实现
1、 masther thread flush
2、 redo log 满了
3、buffer pool 满了 达到脏页阈值 innodb_io_capacity 需要释放page cache 如果是正常的页 直接释放 ,如果是脏页 需要进行刷新,刷脏页的过程是要将内存页写入磁盘,由于刷脏页的逻辑会占用 IO 资源并可能影响到了你的更新语句