暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
MySQL特性之double write
1007
7页
17次
2020-05-30
免费下载
double write
InnoDB关键特性之double write - GeaoZhang - 博客园
MySQLdouble write 浅析_ITPUB博客
https://dev.mysql.com/doc/refman/8.0/en/innodb-doublewrite-buffer.html
為什麼Oracle沒有double write———Roger
Doublewrite Buffer
The doublewrite buffer is a storage area located in the system tablespace where InnoDB
writes pages that are flushed from the InnoDB buffer pool, before the pages are written to
their proper positions in the data file. Only after flushing and writing pages to the
doublewrite buffer, does InnoDB write pages to their proper positions. If there is an
operating system, storage subsystem, or mysqld process crash in the middle of a page
write, InnoDB can later find a good copy of the page from the doublewrite buffer during
crash recovery.
Although data is always written twice, the doublewrite buffer does not require twice as
much I/O overhead or twice as many I/O operations. Data is written to the doublewrite
buffer itself as a large sequential chunk, with a single fsync()call to the operating system.
The doublewrite buffer is enabled by default in most cases. To disable the doublewrite
buffer, set innodb_doublewrite to 0.
If system tablespace files (“ibdata files”) are located on Fusion-io devices that support
atomic writes, doublewrite buffering is automatically disabled and Fusion-io atomic writes
are used for all data files. Because the doublewrite buffer setting is global, doublewrite
buffering is also disabled for data files residing on non-Fusion-io hardware. This feature is
only supported on Fusion-io hardware and is only enabled for Fusion-io NVMFS on Linux.
To take full advantage of this feature, an innodb_flush_method setting ofO_DIRECTis
recommended.
Doublewrite Buffer
Doublewrite缓冲区是位于系统表空间中的存储区域,在将⻚⾯写⼊数据⽂件中的正确位置之
前,InnoDB写⼊从InnoDB缓冲池中刷新的⻚⾯。只有在将⻚⾯刷新并写⼊双写缓冲区后,才
InnoDB将⻚⾯写⼊正确的位置。如果在⻚⾯写⼊过程中存在操作系统,存储⼦系统或
mysqld 进程崩溃,则InnoDB可以在崩溃恢复期间从doublewrite缓冲区中找到该⻚⾯的良好
副本。
尽管数据总是写⼊两次,但双写缓冲区不需要两倍的I / O开销或两倍的I / O操作。数据作为⼀
个⼤的顺序块写⼊doublewrite缓冲区本身,只需⼀次fsync()调⽤操作系统。
在⼤多数情况下,默认情况下启⽤doublewrite缓冲区。要禁⽤双写缓冲区,请设置
innodb_doublewrite 0
如果系统表空间⽂件(“ibdata⽂件)位于⽀持原⼦写⼊的Fusion-io设备上,则会⾃动禁⽤双
写缓冲,并且Fusion-io原⼦写⼊将⽤于所有数据⽂件。由于双写缓冲区设置是全局的,因此对
于驻留在⾮Fusion-io硬件上的数据⽂件也禁⽤双写缓冲。此功能仅在Fusion-io硬件上受⽀
持,仅适⽤于Linux上的Fusion-io NVMFS。要充分利⽤此功能,建议进⾏
innodb_flush_method 设置O_DIRECT
关于IO的最⼩单位:
  1、数据库IO的最⼩单位是16KMySQL默认,oracle8K
  2、⽂件系统IO的最⼩单位是4K(也有1K的)
  3、磁盘IO的最⼩单位是512字节
因此,存在IO写⼊导致page损坏的⻛险:
of 7
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜