org.apache.ignite.internal.processors.cache.persistence

## Class DataStorageMetricsImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.DataStorageMetricsImpl

All Implemented Interfaces:
  DataStorageMetrics, DataStorageMetricsMXBean

    public class DataStorageMetricsImpl
    extends Object
    implements DataStorageMetricsMXBean

### Constructor Summary

Constructors
Constructor and Description
`DataStorageMetricsImpl(boolean metricsEnabled, long rateTimeInterval, int subInts)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `disableMetrics()` Disables persistence metrics collection on an Apache Ignite node.
`void` `enableMetrics()` Enables persistence metrics collection on an Apache Ignite node.
`long` `getCheckpointTotalTime()` Total checkpoint time from last restart.
`long` `getDirtyPages()` Total dirty pages for the next checkpoint.
`long` `getLastCheckpointCopiedOnWritePagesNumber()` Gets the number of pages copied to a temporary checkpoint buffer during the last checkpoint.
`long` `getLastCheckpointDataPagesNumber()` Gets the number of data pages written during the last checkpoint.
`long` `getLastCheckpointDuration()` Gets the duration of the last checkpoint in milliseconds.
`long` `getLastCheckpointFsyncDuration()` Gets the duration of the sync phase of the last checkpoint in milliseconds.
`long` `getLastCheckpointLockWaitDuration()` Gets the duration of last checkpoint lock wait in milliseconds.
`long` `getLastCheckpointMarkDuration()` Gets the duration of last checkpoint mark phase in milliseconds.
`long` `getLastCheckpointPagesWriteDuration()` Gets the duration of last checkpoint pages write phase in milliseconds.
`long` `getLastCheckpointTotalPagesNumber()` Gets the total number of pages written during the last checkpoint.
`long` `getOffHeapSize()` Total offheap size in bytes.
`long` `getOffheapUsedSize()` Total used offheap size in bytes.
`long` `getPagesRead()` The number of read pages from last restart.
`long` `getPagesReplaced()` The number of replaced pages from last restart.
`long` `getPagesWritten()` The number of written pages from last restart.
`long` `getTotalAllocatedSize()` Total size of memory allocated in bytes.
`int` `getWalArchiveSegments()` Gets the current number of WAL segments in the WAL archive.
`long` `getWalBuffPollSpinsRate()` Returns WAL buffer poll spins number over the last time interval.
`float` `getWalFsyncTimeAverage()` Gets the average WAL fsync duration in microseconds over the last time interval.
`long` `getWalLastRollOverTime()` Time of the last WAL segment rollover.
`float` `getWalLoggingRate()` Gets the average number of WAL records per second written during the last time interval.
`long` `getWalTotalSize()` Total size in bytes for storage wal files.
`float` `getWalWritingRate()` Gets the average number of bytes per second written during the last time interval.
`boolean` `metricsEnabled()`
`void` `onBuffPollSpin(int num)`
`void` `onCheckpoint(long lockWaitDuration, long markDuration, long pagesWriteDuration, long fsyncDuration, long duration, long totalPages, long dataPages, long cowPages)`
`void` `onFsync(long nanoTime)`
`void` `onWalBytesWritten(int size)`
`void` `onWallRollOver()`
`void` `onWalRecordLogged()`
`void` `rateTimeInterval(long rateTimeInterval)` Sets time interval for rate-based metrics.
`void` `regionMetrics(Collection<DataRegionMetrics> regionMetrics)`
`void` `setWalSizeProvider(IgniteOutClosure<Long> walSizeProvider)`
`void` `subIntervals(int subInts)` Sets a number of sub-intervals the whole `DataStorageMetricsMXBean.rateTimeInterval(long)` will be split into to calculate rate-based metrics.
`void` `wal(IgniteWriteAheadLogManager wal)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DataStorageMetricsImpl

    public DataStorageMetricsImpl(boolean metricsEnabled,
                                  long rateTimeInterval,
                                  int subInts)

Parameters:
  `metricsEnabled` - Metrics enabled flag.
  `rateTimeInterval` - Rate time interval.
  `subInts` - Number of sub-intervals.

### Method Detail

#### getWalLoggingRate

    public float getWalLoggingRate()

Gets the average number of WAL records per second written during the last time interval.

The length of time interval is configured via `DataStorageConfiguration.setMetricsRateTimeInterval(long)` configuration property. The number of subintervals is configured via `DataStorageConfiguration.setMetricsSubIntervalCount(int)` configuration property.

Specified by:
  `getWalLoggingRate` in interface `DataStorageMetrics`
Specified by:
  `getWalLoggingRate` in interface `DataStorageMetricsMXBean`

#### getWalWritingRate

    public float getWalWritingRate()

Gets the average number of bytes per second written during the last time interval. The length of time interval is configured via `DataStorageConfiguration.setMetricsRateTimeInterval(long)` configuration property. The number of subintervals is configured via `DataStorageConfiguration.setMetricsSubIntervalCount(int)` configuration property.

Specified by:
  `getWalWritingRate` in interface `DataStorageMetrics`
Specified by:
  `getWalWritingRate` in interface `DataStorageMetricsMXBean`

#### getWalArchiveSegments

    public int getWalArchiveSegments()

Gets the current number of WAL segments in the WAL archive.

Specified by:
  `getWalArchiveSegments` in interface `DataStorageMetrics`
Specified by:
  `getWalArchiveSegments` in interface `DataStorageMetricsMXBean`

#### getWalFsyncTimeAverage

    public float getWalFsyncTimeAverage()

Gets the average WAL fsync duration in microseconds over the last time interval.

The length of time interval is configured via `DataStorageConfiguration.setMetricsRateTimeInterval(long)` configuration property. The number of subintervals is configured via `DataStorageConfiguration.setMetricsSubIntervalCount(int)` configuration property.

Specified by:
  `getWalFsyncTimeAverage` in interface `DataStorageMetrics`
Specified by:
  `getWalFsyncTimeAverage` in interface `DataStorageMetricsMXBean`

#### getWalBuffPollSpinsRate

    public long getWalBuffPollSpinsRate()

Returns WAL buffer poll spins number over the last time interval.

The length of time interval is configured via `DataStorageConfiguration.setMetricsRateTimeInterval(long)` configuration property. The number of subintervals is configured via `DataStorageConfiguration.setMetricsSubIntervalCount(int)` configuration property.

Specified by:
  `getWalBuffPollSpinsRate` in interface `DataStorageMetrics`
Specified by:
  `getWalBuffPollSpinsRate` in interface `DataStorageMetricsMXBean`

#### getLastCheckpointDuration

    public long getLastCheckpointDuration()

Gets the duration of the last checkpoint in milliseconds.

Specified by:
  `getLastCheckpointDuration` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointDuration` in interface `DataStorageMetricsMXBean`
Returns:
  Total checkpoint duration in milliseconds.

#### getLastCheckpointLockWaitDuration

    public long getLastCheckpointLockWaitDuration()

Gets the duration of last checkpoint lock wait in milliseconds.

Specified by:
  `getLastCheckpointLockWaitDuration` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointLockWaitDuration` in interface `DataStorageMetricsMXBean`
Returns:
  Checkpoint lock wait time in milliseconds.

#### getLastCheckpointMarkDuration

    public long getLastCheckpointMarkDuration()

Gets the duration of last checkpoint mark phase in milliseconds.

Specified by:
  `getLastCheckpointMarkDuration` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointMarkDuration` in interface `DataStorageMetricsMXBean`
Returns:
  Checkpoint mark duration in milliseconds.

#### getLastCheckpointPagesWriteDuration

    public long getLastCheckpointPagesWriteDuration()

Gets the duration of last checkpoint pages write phase in milliseconds.

Specified by:
  `getLastCheckpointPagesWriteDuration` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointPagesWriteDuration` in interface `DataStorageMetricsMXBean`
Returns:
  Checkpoint pages write phase in milliseconds.

#### getLastCheckpointFsyncDuration

    public long getLastCheckpointFsyncDuration()

Gets the duration of the sync phase of the last checkpoint in milliseconds.

Specified by:
  `getLastCheckpointFsyncDuration` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointFsyncDuration` in interface `DataStorageMetricsMXBean`
Returns:
  Checkpoint fsync time in milliseconds.

#### getLastCheckpointTotalPagesNumber

    public long getLastCheckpointTotalPagesNumber()

Gets the total number of pages written during the last checkpoint.

Specified by:
  `getLastCheckpointTotalPagesNumber` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointTotalPagesNumber` in interface `DataStorageMetricsMXBean`
Returns:
  Total number of pages written during the last checkpoint.

#### getLastCheckpointDataPagesNumber

    public long getLastCheckpointDataPagesNumber()

Gets the number of data pages written during the last checkpoint.

Specified by:
  `getLastCheckpointDataPagesNumber` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointDataPagesNumber` in interface `DataStorageMetricsMXBean`
Returns:
  Total number of data pages written during the last checkpoint.

#### getLastCheckpointCopiedOnWritePagesNumber

    public long getLastCheckpointCopiedOnWritePagesNumber()

Gets the number of pages copied to a temporary checkpoint buffer during the last checkpoint.

Specified by:
  `getLastCheckpointCopiedOnWritePagesNumber` in interface `DataStorageMetrics`
Specified by:
  `getLastCheckpointCopiedOnWritePagesNumber` in interface `DataStorageMetricsMXBean`
Returns:
  Total number of pages copied to a temporary checkpoint buffer during the last checkpoint.

#### enableMetrics

    public void enableMetrics()

Enables persistence metrics collection on an Apache Ignite node.

Specified by:
  `enableMetrics` in interface `DataStorageMetricsMXBean`

#### disableMetrics

    public void disableMetrics()

Disables persistence metrics collection on an Apache Ignite node.

Specified by:
  `disableMetrics` in interface `DataStorageMetricsMXBean`

#### rateTimeInterval

    public void rateTimeInterval(long rateTimeInterval)

Sets time interval for rate-based metrics. Identical to setting `DataStorageConfiguration.setMetricsRateTimeInterval(long)` configuration property.

Specified by:
  `rateTimeInterval` in interface `DataStorageMetricsMXBean`
Parameters:
  `rateTimeInterval` - Time interval (in milliseconds) used for allocation and eviction rates calculations.

#### subIntervals

    public void subIntervals(int subInts)

Sets a number of sub-intervals the whole `DataStorageMetricsMXBean.rateTimeInterval(long)` will be split into to calculate rate-based metrics. Identical to setting `DataStorageConfiguration.setMetricsSubIntervalCount(int)` configuration property.

Specified by:
  `subIntervals` in interface `DataStorageMetricsMXBean`
Parameters:
  `subInts` - A number of sub-intervals.

#### getWalTotalSize

    public long getWalTotalSize()

Total size in bytes for storage wal files.

Specified by:
  `getWalTotalSize` in interface `DataStorageMetrics`
Specified by:
  `getWalTotalSize` in interface `DataStorageMetricsMXBean`
Returns:
  Total size in bytes for storage wal files.

#### getWalLastRollOverTime

    public long getWalLastRollOverTime()

Time of the last WAL segment rollover.

Specified by:
  `getWalLastRollOverTime` in interface `DataStorageMetrics`
Specified by:
  `getWalLastRollOverTime` in interface `DataStorageMetricsMXBean`
Returns:
  Time of the last WAL segment rollover.

#### getCheckpointTotalTime

    public long getCheckpointTotalTime()

Total checkpoint time from last restart.

Specified by:
  `getCheckpointTotalTime` in interface `DataStorageMetrics`
Specified by:
  `getCheckpointTotalTime` in interface `DataStorageMetricsMXBean`
Returns:
  Total checkpoint time from last restart.

#### getDirtyPages

    public long getDirtyPages()

Total dirty pages for the next checkpoint.

Specified by:
  `getDirtyPages` in interface `DataStorageMetrics`
Specified by:
  `getDirtyPages` in interface `DataStorageMetricsMXBean`
Returns:
  Total dirty pages for the next checkpoint.

#### getPagesRead

    public long getPagesRead()

The number of read pages from last restart.

Specified by:
  `getPagesRead` in interface `DataStorageMetrics`
Specified by:
  `getPagesRead` in interface `DataStorageMetricsMXBean`
Returns:
  The number of read pages from last restart.

#### getPagesWritten

    public long getPagesWritten()

The number of written pages from last restart.

Specified by:
  `getPagesWritten` in interface `DataStorageMetrics`
Specified by:
  `getPagesWritten` in interface `DataStorageMetricsMXBean`
Returns:
  The number of written pages from last restart.

#### getPagesReplaced

    public long getPagesReplaced()

The number of replaced pages from last restart.

Specified by:
  `getPagesReplaced` in interface `DataStorageMetrics`
Specified by:
  `getPagesReplaced` in interface `DataStorageMetricsMXBean`
Returns:
  The number of replaced pages from last restart.

#### getOffHeapSize

    public long getOffHeapSize()

Total offheap size in bytes.

Specified by:
  `getOffHeapSize` in interface `DataStorageMetrics`
Specified by:
  `getOffHeapSize` in interface `DataStorageMetricsMXBean`
Returns:
  Total offheap size in bytes.

#### getOffheapUsedSize

    public long getOffheapUsedSize()

Total used offheap size in bytes.

Specified by:
  `getOffheapUsedSize` in interface `DataStorageMetrics`
Specified by:
  `getOffheapUsedSize` in interface `DataStorageMetricsMXBean`
Returns:
  Total used offheap size in bytes.

#### getTotalAllocatedSize

    public long getTotalAllocatedSize()

Total size of memory allocated in bytes.

Specified by:
  `getTotalAllocatedSize` in interface `DataStorageMetrics`
Specified by:
  `getTotalAllocatedSize` in interface `DataStorageMetricsMXBean`
Returns:
  Total size of memory allocated in bytes.

#### wal

    public void wal(IgniteWriteAheadLogManager wal)

Parameters:
  `wal` - Write-ahead log manager.

#### setWalSizeProvider

    public void setWalSizeProvider(IgniteOutClosure<Long> walSizeProvider)

Parameters:
  `walSizeProvider` - Wal size provider.

#### onWallRollOver

    public void onWallRollOver()

#### regionMetrics

    public void regionMetrics(Collection<DataRegionMetrics> regionMetrics)

#### metricsEnabled

    public boolean metricsEnabled()

Returns:
  Metrics enabled flag.

#### onCheckpoint

    public void onCheckpoint(long lockWaitDuration,
                             long markDuration,
                             long pagesWriteDuration,
                             long fsyncDuration,
                             long duration,
                             long totalPages,
                             long dataPages,
                             long cowPages)

Parameters:
  `lockWaitDuration` - Lock wait duration.
  `markDuration` - Mark duration.
  `pagesWriteDuration` - Pages write duration.
  `fsyncDuration` - Total checkpoint fsync duration.
  `duration` - Total checkpoint duration.
  `totalPages` - Total number of all pages in checkpoint.
  `dataPages` - Total number of data pages in checkpoint.
  `cowPages` - Total number of COW-ed pages in checkpoint.

#### onWalRecordLogged

    public void onWalRecordLogged()

#### onWalBytesWritten

    public void onWalBytesWritten(int size)

Parameters:
  `size` - Size written.

#### onFsync

    public void onFsync(long nanoTime)

Parameters:
  `nanoTime` - Fsync nano time.

#### onBuffPollSpin

    public void onBuffPollSpin(int num)

Parameters:
  `num` - Number.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.5.0
Release Date | : May 23 2018