GitHub user agresch opened a pull request:
https://github.com/apache/storm/pull/2504
STORM-2156: store metrics into RocksDB
This PR adds a RocksDB key/value database to Nimbus for storing metrics
from the Supervisors. The implementation is replaceable by implementing the
MetricStore interface and updating the storm.metricstore.class configuration
option.
As metrics are stored in RocksDB, their string values (for topology id and
executor Id, etc.) are converted to unique integer Ids, and these strings are
also stored to the database as metadata indexed by the integer Id. When a
metric is stored, it is also aggregated with any existing metric within the
same 1, 10, and 60 minute timeframe.
Metric.java contains all the relevant metric properties stored in the
database.
FilterOptions.java provides all the options available to pass to scan the
database for various metrics.
The Supervisor sends metrics (currently only for memory usage) to Nimbus by
thrift in processMetrics() in Container.java
Nimbus receives the Supervisor metrics and inserts them in the database in
processWorkerMetrics().
RocksDbStore is the RocksDB metric store implementation.
RocksDbKey provides documentation on how metric data and metadata strings
are stored as a key in RocksDB. RocksDbValue provides similar documentation
for the value format.
StringMetadataCache provides an in-memory cache of the most recently used
string metadata for fast lookup. The cache size is configurable.
RocksDbMetricsWriter performs the metric writes to RocksDB, taking metrics
off the queue and aggregating with existing data, and storing metadata as
required. There's a single thread inserting to prevent threading issues.
Metric database inserts in my tests typically take 80 to 150 microseconds
(including the aggregation) for an individual metric.
MetricsCleaner exists to periodically delete old metrics and remove unused
metadata strings. Metric retention time is configurable.
RocksDbStoreTest provide sample code for inserting and searching for
metrics.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/agresch/storm agresch_rocksdb
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/storm/pull/2504.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2504
----
commit 517310586e69a139002140fec12b2e12527a0fa2
Author: Aaron Gresch <agresch@...>
Date: 2017-12-07T17:36:03Z
STORM-2156: store metrics into RocksDB
----
---