Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

RocksDB Statistics in Metrics #1169

Merged
merged 19 commits into from
Apr 11, 2019
Merged

RocksDB Statistics in Metrics #1169

merged 19 commits into from
Apr 11, 2019

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Mar 26, 2019

PR description

Expose all the RocksDB statistics as metrics

When we add the no-op metrics optimization this broke push-metrics.
# Conflicts:
#	metrics/src/test/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystemTest.java
fix histogram name
# Conflicts:
#	services/kvstore/build.gradle
#	services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.java
@shemnon shemnon marked this pull request as ready for review April 11, 2019 19:01
((PrometheusMetricsSystem) metricsSystem)
.addCollector(ROCKSDB_STATS, histogramToCollector(histogram));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you wrap all of this new logic up in a utility class in the metrics package? That way we can reuse this for other RocksDB instances as needed. It looks like you could create a RocksDBStats class with methods getStatistics() and registerMetrics(MetricsSystem metrics, MetricsCategory category).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we keeps the statistics object in rocksdb and treat it like a part of the options then we can have RocksDBStats have just static methods.


// Histograms - treated as prometheus summaries
static final HistogramType[] HISTOGRAMS = {
HistogramType.DB_GET, // COUNT : 4716170 SUM : 29514961
Copy link
Contributor

Choose a reason for hiding this comment

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

What are all of these comments for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previous measurements. I'm was trying to see if there were stats we should get rid of. But the performance latency impact of keeping all of them is almost unmeasurable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted

@@ -24,13 +24,14 @@
PEERS("peers"),
PROCESS("process", false),
ROCKSDB("rocksdb"),
ROCKSDB_STATS("rocksdb", false),
Copy link
Contributor

Choose a reason for hiding this comment

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

Also - might be worth making these category names more accurate while you're in here. Perhaps: ROCKSDB_KVSTORE / ROCKSDB_KVSTORE_STATS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with KVSTORE_ROCKSDB in case we ever switch DBs it has good hierarchy: KVSTORE_MEMDB, KVSTORE_JDBC, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah - thats better

TickerType.NO_FILE_ERRORS,
// TickerType.STALL_L0_SLOWDOWN_MICROS,
// TickerType.STALL_MEMTABLE_COMPACTION_MICROS,
// TickerType.STALL_L0_NUM_FILES_MICROS,
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume we want to keep these here for visibility of all of the options?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, to make it clear their absence is intentional.

Copy link
Contributor

Choose a reason for hiding this comment

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

(optional) Might be worth an explanatory comment :)

@@ -0,0 +1,198 @@
package tech.pegasys.pantheon.services.kvstore;
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about moving this to: tech.pegasys.pantheon.metrics.rocksdb. We have a similar paradigm for vertx utilities in tech.pegasys.pantheon.metrics.vertx.

};

static void registerRocksDBMetrics(
final Statistics stats, final PrometheusMetricsSystem metricsSystem) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you move this to the metrics package and inject MetricsCategory, we can reuse this elsewhere. For example, in the RocksDbTaskQueue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would give the metrics package a dependency on RocksDB, and then every package that uses metrics would drag that dependency along as deadweight.

Copy link
Contributor

@mbaxter mbaxter Apr 11, 2019

Choose a reason for hiding this comment

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

Yeah, thats a good point. And that's the case now with vertx. I guess the "right" thing to do would be to have independent vertxmetrics and rocksdbmetrics packages modules.

Copy link
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

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

I think it would be good to figure out a way to put the RocksDB metric utils in a generally available package, but I don't want to block the PR based on that. We can always follow-up with another ticket to do a bit of reorganization if need be.

@shemnon
Copy link
Contributor Author

shemnon commented Apr 11, 2019

I will do the refactoring in a follow on PR because creating the module that will be needed has some long tendrils.

@shemnon shemnon merged commit b345388 into PegaSysEng:master Apr 11, 2019
@shemnon shemnon deleted the db_perf branch April 11, 2019 23:44
notlesh pushed a commit to notlesh/pantheon that referenced this pull request Apr 24, 2019
Expose all the RocksDB statistics as metrics
notlesh pushed a commit to notlesh/pantheon that referenced this pull request May 4, 2019
Expose all the RocksDB statistics as metrics
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants