The innodb_flush_method variable is used to define how log and data files are flushed from InnoDB.
Optimizing this value may yield improvements in I/O throughput.
Innodb_flush_method configuration can cause unexpected and unwanted results. Testing and benchmarking is recommended. The most common configuration is setting innodb_flush_method to O_DIRECT. This reduces swap pressure by preventing unnecessary double buffering, which is when the operating system is buffering some data in its cache alongside InnoDB's caches.
For reference, the innodb_flush_method default values for MySQL, Percona, and MariaDB are listed above. Innodb_flush_method variable configuration:
- To change innodb_flush_method in the command line, enter:
Replace the bolded value with the best option for your database.
- You can also change the value of innodb_flush_method using a configuration file. To do so, you will use mysqld. You will need to restart MySQL:
Adjust the bolded value with one of the valid variable values, to suit your database needs.