Effect of innodb_log_buffer_size on Redo Log I/O in MySQL
This article experimentally demonstrates how increasing MySQL's innodb_log_buffer_size reduces redo‑log write I/O, showing fewer write operations but similar total data volume, and explains why performance gains may be subtle in typical virtual‑machine storage environments.
Problem
MySQL documentation states that innodb_log_buffer_size is the write buffer for the redo log, and setting it larger can reduce write operations.
Experiment
We create a database and first set innodb_log_buffer_size to its minimum value.
Next, we create a table with data following the steps in Experiment 11, repeatedly executing an INSERT until the table contains 65,536 rows.
We then duplicate the table so that we can run two separate experiments.
After that, we enable InnoDB metrics and performance_schema to collect detailed statistics.
We execute a single INSERT and calculate the LSN (Log Sequence Number) difference, which indicates how much redo log the transaction generated.
The result shows that the transaction produced roughly 3 MB of redo log.
We also examine the I/O activity for this operation, which recorded seven I/O events: six writes and one sync, each write taking about 0.8 ms.
Next, we modify my.cnf to set innodb_log_buffer_size to its default value of 16,777,216, restart the database, and re‑enable InnoDB metrics and performance_schema .
We run another INSERT on the duplicated table (t2) and again measure the LSN difference, which again yields about 3 MB of redo log.
This time the I/O count drops to only two events: one write and one sync.
Conclusion
innodb_log_buffer_size acts as a redo‑log write cache; when the buffer is too small, multiple I/O writes occur to flush the cached data to disk.
A larger innodb_log_buffer_size reduces the number of I/O operations.
In a typical virtual‑machine environment with average storage, although the number of write I/O operations decreases, the total amount of data written remains similar, so overall I/O latency is roughly unchanged. On higher‑performance storage, fewer write operations can lead to noticeably lower latency.
Therefore, after adjusting this parameter, many users may not perceive a significant performance improvement.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.