Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

CPU overhead from lock_tables is about 2X larger for MyRocks than for InnoDB #1484

Description

@mdcallag

I am looking at flamegraphs from sysbench with a cached database and 1 client. A common problem I see is that the percentage of samples that lock_tables (and its callees) accounts for is ~2X larger in MyRocks than in InnoDB with simple microbenchmarks.

Using results from the insert microbenchmark, for InnoDB

1.58% -> lock_tables
  1.13% -> mysql_lock_tables
    0.35% -> get_lock-data
    0.45% -> handler::ha_external_lock

And from MyRocks

2.89% -> lock_tables
  2.51% -> mysql_lock_tables
    2.09% -> handler::ha_external_lock
      1.81% -> ha_rocksdb::external_lock
        1.31% -> myrocks::get_or_create_tx
          1.17% -> Rdb_transaction_impl::start_tx
            0.91% -> rocksdb::WriteCommittedTxnDB::BeginTransaction
              0.80% -> rocksdb::PessimisticTransaction::Reinitialize

The flamegraphs are attached:
sb perf g insert range100 pk1 all
sb perf g insert range100 pk1 all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions