Skip to content

ha_statistic_increment uses ~5% of CPU on table scan benchmarks #1481

@mdcallag

Description

@mdcallag

While running sysbench as explained here with a database that is cached by RocksDB from flamegraphs I see that ha_statistic_increment accounts for about 5% of the samples on the scan microbenchmark on a small server with 1 client connection and a large server with 24 client connections. After editing the function to make it cheaper I get between 5% and 10% more throughput.

The upstream version is here and just increments a per-handler counter.

The MyRocks version is here and does a bit more. The call to check_yield is the most expensive addition. The next most expensive change is the call to update_sql_stats_periodic.

A flamegraph from the small server

sb perf g range-covered-pk pre range100 pk1 all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions