[MySQL 优化] 移除多余的checksum

1.bug#64170
根据bug#64170的描述,一个page在读入内存时就已经计算了一次checksum:
buf_page_get_gen
       |–>buf_read_page   (buf0buf.c:2543)
              ->buf_read_page_low
                  ->buf_page_io_complete
                       ->buf_page_is_corrupted
                             ->page_zip_calc_checksum
2612     case BUF_BLOCK_ZIP_PAGE:
2613     case BUF_BLOCK_ZIP_DIRTY
       |–> success = buf_zip_decompress(block, srv_use_checksums);
在函数buf_zip_decompress中,当设置了innodb_checksums时(对应内部变量srv_use_checksums),则在需要先计算比比较checksum,然后才会调用page_zip_decompress解压。
也就是说,对于一个page,总共进行了两次checksum,第二次明显是多余的。在MySQL5.6.7也已经移除了第二次checksum。
PerformanceInnoDB: This fix removes redundant checksum validation on InnoDB pages. The checksum was being verified both when a compressed page was read from disk and when it was uncompressed. Now the verification is only performed when the page is read from disk. (Bug #14212892, Bug #64170)
根据Facebook的Mark Callaghan的测试,获得了5%的QPS提升。
.
.
2.bug#64715
在函数buf_LRU_free_block中,对于压缩page,即使是非脏页,也会去计算checksum,facebook为其增加了一个参数来控制,为false表示禁止这种行为,只checksum脏页
当buffer pool较小时,free list一般为空,这时候当需要从磁盘读取一个page后,就得从lru上驱逐一个block。因此会频繁的调用到buf_LRU_free_block
对于只读查询,这会减少一些CPU开销(简单的测试,很明显的usr cpu 从13%降到12%)

原创文章,转载请注明: 转载自Simple Life

本文链接地址: [MySQL 优化] 移除多余的checksum

Post Footer automatically generated by wp-posturl plugin for wordpress.


Comments

Leave a Reply

Your email address will not be published. Name and email are required


Current month ye@r day *