innodb_log_file_size in MySQL
MySQL InnoDB uses redo logs to help maintain database consistency and support crash recovery. The innodb_log_file_size setting defines the size of each redo log file in the log group.
Choosing an appropriate redo log size can influence both database performance and recovery time.
What Is innodb_log_file_size?
You can check the setting with:
SHOW VARIABLES LIKE 'innodb_log_file_size';
In MySQL 8.4, the documented default is 48 MB per log file, with a minimum of 4 MB.
For older configurations using two log files, the total redo log space is effectively:
Total redo log size =
innodb_log_file_size × innodb_log_files_in_group
Why Does Log File Size Matter?
Larger redo logs can allow InnoDB to handle periods of heavy write activity with less checkpoint flushing, which can reduce disk I/O.
However, very large redo logs can increase the amount of work required during crash recovery. MySQL recommends sizing redo capacity according to the workload rather than simply choosing the largest possible value.
Configure the Setting
In legacy MySQL configurations, you could define:
[mysqld]
innodb_log_file_size=512M
The exact configuration process depends on the MySQL version and deployment.
Important: Modern MySQL Uses innodb_redo_log_capacity
For current MySQL 8.4, innodb_log_file_size and innodb_log_files_in_group are deprecated and have been superseded by innodb_redo_log_capacity.
For example:
[mysqld]
innodb_redo_log_capacity=8G
This is the preferred approach for modern MySQL versions.
Performance Considerations
A suitable redo log capacity can help smooth out peaks in write activity and reduce unnecessary checkpoint flushing.
Do not change the setting simply because a larger value sounds faster. Database workload, storage performance, available memory, and recovery requirements should all be considered.
Best Practices
Monitor database performance before and after changing redo log settings. Test configuration changes in an environment similar to production and always maintain a reliable backup strategy.
For modern MySQL installations, prefer innodb_redo_log_capacity instead of building new configurations around the deprecated innodb_log_file_size.
Conclusion
innodb_log_file_size is an important InnoDB redo-log setting that historically controlled the size of individual redo log files. Larger log capacity can reduce checkpoint pressure and disk I/O, but excessive sizing can increase recovery time.
For current MySQL versions, developers should use innodb_redo_log_capacity as the primary redo-log configuration setting.