Wednesday, August 7, 2024

MySQL regressions: binlog_log_row

I started to look at CPU overheads in MyRocks and upstream InnoDB. While I am happy to file bugs for MyRocks as they are likely to be fixed, I am not sure how much energy I want to put into proper bug reports for upstream InnoDB. So I will just write blog posts about them for now.

I created flamegraphs while running sysbench with cached databases (more likely to be CPU bound) and the problem here occurs on an 8-core PN53 where sysbench was run with 1 thread. For the insert microbenchmark the insert rate ...

  • in MySQL 5.7.44 is 82% of the rate in MySQL 5.6.51
  • in MySQL 8.0.11 is 72% of the rate in MySQL 5.6.51
  • in MySQL 8.0.37 is 57% of the rate in MySQL 5.6.51 
Here I use perf record -e cycles to collect data for flamegraphs and then I focus on the percentage of samples in a given function (and its callees) as a proxy for CPU overhead.

The percentage of samples that binlog_log_row and its children account for is ...

  • 3.04% in MySQL 5.6.51
  • 4.28% in MySQL 5.7.44
  • 10.29% in MySQL 8.0.37
I don't know what happened to make this so much more expensive in 8.0. The numbers below are the percentage samples in the function and the functions it calls. The flamegraph (*.svg) files are here.

For MySQL 5.6.51 with InnoDB

3.04  binlog_log_row
  2.23  THD::binlog_write_table_map
    0.41  Table_map_log_event::Table_map_log_event
    0.52  binlog_cache_data::write_event
    0.92  binlog_start_trans_and_stmt
  0.59  Write_rows_log_event::binlog_row_logging_function
    0.51 THD::binlog_write_row

For MySQL 5.7.44 with InnoDB

4.28  binlog_log_row
  3.13  THD::binlog_write_table_map
  0.82  Write_rows_log_event::binlog_row_logging_function

For MySQL 8.0.37 with InnoDB

10.29  binlog_log_row
  5.79  THD::binlog_write_table_map
    2.53  Table_map_log_event::Table_map_log_event
    0.60  binlog_cache_data::write_event
    1.74  binlog_start_trans_and_stmt
  2.97  Write_rows_log_event::binlog_row_logging_function
    2.87 THD::binlog_write_row
  0.49  add_pke

No comments:

Post a Comment

Fixing some of the InnoDB scan perf regressions in a MySQL fork

I recently learned of Advanced MySQL , a MySQL fork, and ran my sysbench benchmarks for it. It fixed some, but not all, of the regressions f...