innodb_flush_method
The innodb_flush_method parameter specifies how InnoDB opens and flushes the log and data files.
Optimizations
In InnoDB optimization, setting this parameter tweaks the database performance when applicable.
The following options are for flushing the files through InnoDB:
-
fsync. InnoDB uses thefsync()system call to flush both the data and log files. This option is the default setting. -
O_DSYNC. InnoDB uses theO_DSYNCoption to open and flush the log files and fsync() to flush the data files. InnoDB does not useO_DSYNCdirectly, because there have been problems with it on many varieties of UNIX. -
O_DIRECT. InnoDB uses theO_DIRECToption (ordirectio()on Solaris) to open the data files and usesfsync()to flush both the data and log files. This option is available on some GNU/Linux versions, FreeBSD, and Solaris. -
O_DIRECT_NO_FSYNC. InnoDB uses theO_DIRECToption during flushing I/O; however, it skips thefsync()system call afterward. This option is unsuitable for some types of file systems (for example, XFS). If you are not sure if your file system requires anfsync()system call—for example, to preserve all file metadata—use theO_DIRECToption instead.
Observation
In the NetApp lab tests, the fsync default option was used on NFS and SAN, and it was a great performance improviser compared to O_DIRECT. While using the flush method as O_DIRECT with ONTAP, we observed that the client writes a lot of single-byte writes at the border of the 4096 block in serial fashion. These writes increased latency over the network and degraded performance.