Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add aggregated rocksdb metrics #6354

Merged
merged 4 commits into from
Oct 16, 2020

Conversation

rodesai
Copy link
Contributor

@rodesai rodesai commented Oct 2, 2020

This patch adds a pattern for computing/reporting metrics that return aggregates
of the rocksdb metrics added by KIP-607. Additionally, this particular PR adds the
following metrics:

num-running-compactions-total: the total number of running compactions
estimate-num-keys-total: an estimate of the total number of rocksdb keys
block-cache-usage-total: total memory usage of all block cache
block-cache-pinned-usage-total: total memory used by pinned blocks
estimate-table-readers-mem-total: estimate of the total table readers mem

ksqlDB registers for notification about new rocksdb metrics by creating a
MetricsReporter implementation called RocksDBMetricCollector. The metrics
system calls into MetricsReporter.metricChange when a new metric is added.
RocksDBMetricCollector looks out for rocksdb property metrics it cares about
and tracks them under the relevant aggregates. Each aggregate is registered
with the ksql metrics context on the first instantiation of
RocksDBMetricCollector.

Metrics are computed lazily when read, and are rate-limited to a configurable
interval. The interval is set using the property
ksql.rocksdb.metrics.update.interval.seconds

One alternative I considered was to dynamically add the metrics as they are sent
to RocksDBMetricCollector.metricChange (rather than hard-coding a static list).
Opted not to do this in case we add metrics in the future that use different types,
or want to compute different aggregates (e.g. for some metrics maybe a max or
average makes more sense)

Testing done

Ran our aggregation benchmark with these metrics collected and 1000 partitions
and didn't see any perf regression (processing rate 39098 records/second)

@rodesai rodesai requested a review from a team as a code owner October 2, 2020 23:06
This patch adds metrics that return aggregates of the rocksdb metrics
added by KIP-607. Specifically, this particular PR adds the following metics:

num-running-compactions-total: the total number of running compactions
estimate-num-keys-total: an estimate of the total number of rocksdb keys
block-cache-usage-total: total memory usage of all block cache
block-cache-pinned-usage-total: total memory used by pinned blocks
estimate-table-readers-mem-total: estimate of the total table readers mem

ksqlDB registers for notification about new rocksdb metrics by creating a
MetricsReporter implementation called RocksDBMetricCollector. The metrics
system calls into MetricsReporter.metricChange when a new metric is added.
RocksDBMetricCollector looks out for rocksdb property metrics it cares about
and tracks them under the relevant aggregates. Each aggregate is registered
with the ksql metrics context on the first instantiation of
RocksDBMetricCollector.

Metrics are computed lazily when read, and are rate-limited to a configurable
interval. The interval is set using the property
ksql.rocksdb.metrics.update.interval.seconds
Copy link
Member

@vvcephei vvcephei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @rodesai , looks reasonable to me!

@rodesai rodesai merged commit ecc6625 into confluentinc:master Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants