Skip to content

util/metric: histograms and other metrics are too damn expensive #30644

@andreimatei

Description

@andreimatei

As seen in this comment, the metrics that we update frequently (e.g. the txn metrics) have a measurable cost probably because of their internal mutual exclusion. In particular, the histograms seems to be expensive.
The PR linked above avoids updating a transaction restarts histogram in the common case when transactions don't restart. Such histograms would benefit from an optimized path for an "expected value" where they should be as cheap as a counter.
Beyond that, we could try techniques for eliminating mutual exclusion - like maintaining metrics per PCPU and aggregating them on demand. I think I've heard RocksDB does this for their stats.

Jira issue: CRDB-4826

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-performancePerf of queries or internals. Solution not expected to change functional behavior.T-kvKV TeamX-wontfixClosed as we're not going to fix it, even though it's a legitimate issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions