Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the read-on-write in the redo log parameter innodb_log_write_ahead_size of mysql

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to understand the mysql redo log parameter read-on-write in innodb_log_write_ahead_size, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

Let's start with innodb_log_write_ahead_size, which was introduced in 5.7.4.

# innodb_log_write_ahead_size defaults to 8192.

# introduce write-ahead to divide the offset currently written into the redo file by innodb_log_write_ahead_size, and add 0 if it is not divisible, and write more data, so that the written data is consistent with the block size of the disk. In this way, you can write directly to the disk. It saves the process of reading the system memory, then changing the size, and then writing.

Before the introduction of innodb_log_write_ahead_size, redo used read-on-write mode to refresh the disk. The understanding of read-on-write is as follows:

First of all, let's look at the official statement:

Read-on-write occurs when redo log blocks are not entirely cached to the operating system or file system due to a mismatch between write-ahead block size for redo logs and operating system or file system cache block size.

I probably understand the following read-on-write: innodb is written to redo files in 512-byte block. The average linux file system is 4k in size. If the log file block that needs to be written is not in the cache of the operating system, you need to read the corresponding 4k block into the system memory, modify 512 bytes, and then write to disk. Look at the analysis of Taobao. That's what it means.

Write-ahead is introduced to divide the offset currently written into the redo file by innodb_log_write_ahead_size, and if it is not divisible, add 0 and write more data, so that the written data is consistent with the block size of the disk. In this way, you can write directly to the disk. It saves the process of reading the system memory, then changing the size, and then writing.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report