Metrics System

Slack Docker Pulls GitHub edit source

Metrics provide insight into what is going on in the cluster. They are an invaluable resource for monitoring and debugging. Alluxio has a configurable metrics system based on the Coda Hale Metrics Library. In the metrics system, sources generate metrics, and sinks consume these metrics. The metrics system polls sources periodically and passes metric records to sinks.

Alluxio’s metrics are partitioned into different instances corresponding to Alluxio components. Within each instance, users can configure a set of sinks to which metrics are reported. The following instances are currently supported:

  • Master: The Alluxio master process.
  • Worker: The Alluxio worker process.
  • Client: Any process with the Alluxio client library.

Metrics Sink Configuration

A sink specifies where metrics are delivered to. Each instance can report to zero or more sinks.

  • ConsoleSink: Outputs metrics values to the console.
  • CsvSink: Exports metrics data to CSV files at regular intervals.
  • JmxSink: Registers metrics for viewing in a JMX console.
  • GraphiteSink: Sends metrics to a Graphite server.
  • MetricsServlet: Adds a servlet in Web UI to serve metrics data as JSON data.
  • PrometheusMetricsServlet: Adds a servlet in Web UI to serve metrics data in prometheus format

The metrics system is configured via a configuration file that Alluxio expects to be present at $ALLUXIO_HOME/conf/metrics.properties. A custom file location can be specified via the alluxio.metrics.conf.file configuration property. Alluxio provides a metrics.properties.template under the conf directory which includes all configurable properties and guidance of how to specify each property.

Default HTTP JSON Sink

By default, MetricsServlet is enabled in Alluxio leading master and workers.

You can send an HTTP request to /metrics/json/ of the Alluxio leading master to get a snapshot of all metrics in JSON format. Metrics on the Alluxio leading master contains its own instance metrics and a summary of the cluster-wide aggregated metrics.

  1. # Get the metrics in JSON format from Alluxio leading master
  2. $ curl <LEADING_MASTER_HOSTNAME>:<MASTER_WEB_PORT>/metrics/json
  3. # For example, get the metrics from master process running locally with default web port
  4. $ curl 127.0.0.1:19999/metrics/json/

Send an HTTP request to /metrics/json/ of the active Alluxio workers to get per-worker metrics.

  1. # Get the metrics in JSON format from an active Alluxio worker
  2. $ curl <WORKER_HOSTNAME>:<WORKER_WEB_PORT>/metrics/json
  3. # For example, get the metrics from worker process running locally with default web port
  4. $ curl 127.0.0.1:30000/metrics/json/

CSV Sink Setup

This section gives an example of writing collected metrics to CSV files.

First, create the polling directory for CsvSink (if it does not already exist):

  1. $ mkdir /tmp/alluxio-metrics

In the metrics property file, $ALLUXIO_HOME/conf/metrics.properties by default, add the following properties:

  1. # Enable CsvSink
  2. sink.csv.class=alluxio.metrics.sink.CsvSink
  3. # Polling period for CsvSink
  4. sink.csv.period=1
  5. sink.csv.unit=seconds
  6. # Polling directory for CsvSink, ensure this directory exists!
  7. sink.csv.directory=/tmp/alluxio-metrics

If Alluxio is deployed in a cluster, this file needs to be distributed to all the nodes. Restart the Alluxio servers to activate the new configuration changes.

After starting Alluxio, the CSV files containing metrics will be found in the sink.csv.directory. The filename will correspond with the metric name.

Refer to metrics.properties.template for all possible sink specific configurations.

Prometheus Sink Setup

Prometheus is a monitoring tool that can help monitoring Alluxio metrics changes.

In the metrics property file, $ALLUXIO_HOME/conf/metrics.properties by default, add the following properties:

  1. # Enable PrometheusMetricsServlet
  2. sink.prometheus.class=alluxio.metrics.sink.PrometheusMetricsServlet

If Alluxio is deployed in a cluster, this file needs to be distributed to all the nodes. Restart the Alluxio servers to activate new configuration changes.

You can send an HTTP request to /metrics/prometheus/ of the Alluxio leading master or workers to get a snapshot of metrics in Prometheus format.

  1. # Get the metrics in JSON format from Alluxio leading master or workers
  2. $ curl <LEADING_MASTER_HOSTNAME>:<MASTER_WEB_PORT>/metrics/prometheus/
  3. $ curl <WORKER_HOSTNAME>:<WORKER_WEB_PORT>/metrics/prometheus/
  4. # For example, get the metrics from alluxio processes running locally with default web port
  5. $ curl 127.0.0.1:19999/metrics/prometheus/
  6. $ curl 127.0.0.1:30000/metrics/prometheus/

Then configure prometheus.yml pointing to those endpoints to get Alluxio metrics.

  1. scrape_configs:
  2. - job_name: "alluxio master"
  3. metrics_path: '/metrics/prometheus/'
  4. static_configs:
  5. - targets: ['<LEADING_MASTER_HOSTNAME>:<MASTER_WEB_PORT>' ]
  6. - job_name: "alluxio worker"
  7. metrics_path: '/metrics/prometheus/'
  8. static_configs:
  9. - targets: ['<WORKER_HOSTNAME>:<WORKER_WEB_PORT>' ]

Metric Types

Each metric falls into one of the following metric types:

  • Gauge: Records a value
  • Meter: Measures the rate of events over time (e.g., “requests per minute”)
  • Counter: Measures the number of times an event occurs
  • Timer: Measures both the rate that a particular event is called and the distribution of its duration

For more details about the metric types, please refer to the metrics library documentation

Master Web UI Metrics

Besides the raw metrics shown via metrics servlet or custom metrics configuration, users can track key cluster performance metrics in a more human-readable way in the web interface of Alluxio leading master (http://<leading_master_host>:19999/metrics).

Master Metrics

The web page includes the following information:

  • Timeseries for Alluxio space and root UFS space percentage usage information
  • Timeseries for aggregated cluster throughput which is essential for determining the effectiveness of the Alluxio cache
  • Cumulative RPC invocations and operations performed by the Alluxio cluster
  • Cumulative API calls served per mount point that can served as a strong metric for quantifying the latency and potential cost savings provided by Alluxio’s namespace virtualization

The nickname and original metric name corresponding are shown:

Nick NameOriginal Metric Name
Local Alluxio (Domain Socket) Readcluster.BytesReadDomain
Local Alluxio (Domain Socket) Writecluster.BytesWrittenDomain
Local Alluxio (Short-circuit) Readcluster.BytesReadLocal
Local Alluxio (Short-circuit) Writecluster.BytesWrittenLocal
Remote Alluxio Readcluster.BytesReadAlluxio
Remote Alluxio Writecluster.BytesWrittenAlluxio
Under Filesystem Readcluster.BytesReadUfsAll
Under Filesystem Writecluster.BytesWrittenUfsAll

Detailed descriptions of those metrics are in cluster metrics.

Mounted Under FileSystem Read shows the cluster.BytesReadPerUfs.UFS:<UFS_ADDRESS> of each Alluxio UFS. Mounted Under FileSystem Write shows the cluster.BytesWrittenPerUfs.UFS:<UFS_ADDRESS> of each Alluxio UFS.

Logical Operations and RPC Invocations present parts of the master metrics.

Saved Under FileSystem Operations shows the operations fulfilled by Alluxio’s namespace directly without accessing UFSes. Performance improvement can be significant if the target UFS is remote or slow in response. Costs can be saved if the underlying storage charges based on requests.

References

Detailed Alluxio metrics are listed in the metrics list doc. Metrics stored in leading master is exposed via fsadmin report metrics.