Class CacheMetricsSnapshot

    • Constructor Detail

      • CacheMetricsSnapshot

        public CacheMetricsSnapshot()
        Default constructor.
      • CacheMetricsSnapshot

        public CacheMetricsSnapshot​(CacheMetricsImpl m)
        Create snapshot for given metrics.
        Parameters:
        m - Cache metrics.
      • CacheMetricsSnapshot

        public CacheMetricsSnapshot​(CacheMetrics loc,
                                    Collection<CacheMetrics> metrics)
        Constructs merged cache metrics.
        Parameters:
        loc - Metrics for cache on local node.
        metrics - Metrics for merge.
    • Method Detail

      • getCacheHits

        public long getCacheHits()
        The number of get requests that were satisfied by the cache.
        Specified by:
        getCacheHits in interface CacheMetrics
        Returns:
        The number of hits.
      • getCacheHitPercentage

        public float getCacheHitPercentage()
        This is a measure of cache efficiency.
        Specified by:
        getCacheHitPercentage in interface CacheMetrics
        Returns:
        The percentage of successful hits, as a decimal e.g 75.
      • getCacheMisses

        public long getCacheMisses()
        A miss is a get request that is not satisfied.
        Specified by:
        getCacheMisses in interface CacheMetrics
        Returns:
        The number of misses.
      • getCacheMissPercentage

        public float getCacheMissPercentage()
        Returns the percentage of cache accesses that did not find a requested entry in the cache.
        Specified by:
        getCacheMissPercentage in interface CacheMetrics
        Returns:
        The percentage of accesses that failed to find anything.
      • getCacheGets

        public long getCacheGets()
        The total number of requests to the cache. This will be equal to the sum of the hits and misses.
        Specified by:
        getCacheGets in interface CacheMetrics
        Returns:
        The number of gets.
      • getCachePuts

        public long getCachePuts()
        The total number of puts to the cache.
        Specified by:
        getCachePuts in interface CacheMetrics
        Returns:
        The number of puts.
      • getEntryProcessorPuts

        public long getEntryProcessorPuts()
        The total number of cache invocations, caused update.
        Specified by:
        getEntryProcessorPuts in interface CacheMetrics
        Returns:
        The number of invocation updates.
      • getEntryProcessorReadOnlyInvocations

        public long getEntryProcessorReadOnlyInvocations()
        The total number of cache invocations, caused no updates.
        Specified by:
        getEntryProcessorReadOnlyInvocations in interface CacheMetrics
        Returns:
        The number of read-only invocations.
      • getEntryProcessorInvocations

        public long getEntryProcessorInvocations()
        The total number of cache invocations.
        Specified by:
        getEntryProcessorInvocations in interface CacheMetrics
        Returns:
        The number of cache invocations.
      • getEntryProcessorHits

        public long getEntryProcessorHits()
        The total number of invocations on keys, which exist in cache.
        Specified by:
        getEntryProcessorHits in interface CacheMetrics
        Returns:
        The number of cache invocation hits.
      • getEntryProcessorHitPercentage

        public float getEntryProcessorHitPercentage()
        The percentage of invocations on keys, which exist in cache.
        Specified by:
        getEntryProcessorHitPercentage in interface CacheMetrics
        Returns:
        The percentage of successful invocation hits.
      • getEntryProcessorMissPercentage

        public float getEntryProcessorMissPercentage()
        The percentage of invocations on keys, which don't exist in cache.
        Specified by:
        getEntryProcessorMissPercentage in interface CacheMetrics
        Returns:
        The percentage of invocation misses.
      • getEntryProcessorMisses

        public long getEntryProcessorMisses()
        The total number of invocations on keys, which don't exist in cache.
        Specified by:
        getEntryProcessorMisses in interface CacheMetrics
        Returns:
        The number of cache invocation misses.
      • getEntryProcessorRemovals

        public long getEntryProcessorRemovals()
        The total number of cache invocations, caused removal.
        Specified by:
        getEntryProcessorRemovals in interface CacheMetrics
        Returns:
        The number of invocation removals.
      • getEntryProcessorMinInvocationTime

        public float getEntryProcessorMinInvocationTime()
        So far, the minimum time to execute cache invokes.
        Specified by:
        getEntryProcessorMinInvocationTime in interface CacheMetrics
        Returns:
        The time in µs.
      • getEntryProcessorMaxInvocationTime

        public float getEntryProcessorMaxInvocationTime()
        So far, the maximum time to execute cache invokes.
        Specified by:
        getEntryProcessorMaxInvocationTime in interface CacheMetrics
        Returns:
        The time in µs.
      • getCacheRemovals

        public long getCacheRemovals()
        The total number of removals from the cache. This does not include evictions, where the cache itself initiates the removal to make space.
        Specified by:
        getCacheRemovals in interface CacheMetrics
        Returns:
        The number of removals.
      • getCacheEvictions

        public long getCacheEvictions()
        The total number of evictions from the cache. An eviction is a removal initiated by the cache itself to free up space. An eviction is not treated as a removal and does not appear in the removal counts.
        Specified by:
        getCacheEvictions in interface CacheMetrics
        Returns:
        The number of evictions.
      • getAverageGetTime

        public float getAverageGetTime()
        The mean time to execute gets.
        Specified by:
        getAverageGetTime in interface CacheMetrics
        Returns:
        The time in µs.
      • getAveragePutTime

        public float getAveragePutTime()
        The mean time to execute puts.
        Specified by:
        getAveragePutTime in interface CacheMetrics
        Returns:
        The time in µs.
      • getAverageRemoveTime

        public float getAverageRemoveTime()
        The mean time to execute removes.
        Specified by:
        getAverageRemoveTime in interface CacheMetrics
        Returns:
        The time in µs.
      • getAverageTxCommitTime

        public float getAverageTxCommitTime()
        The mean time to execute tx commit.
        Specified by:
        getAverageTxCommitTime in interface CacheMetrics
        Returns:
        The time in µs.
      • getAverageTxRollbackTime

        public float getAverageTxRollbackTime()
        The mean time to execute tx rollbacks.
        Specified by:
        getAverageTxRollbackTime in interface CacheMetrics
        Returns:
        Number of transaction rollbacks.
      • getCacheTxCommits

        public long getCacheTxCommits()
        Gets total number of transaction commits.
        Specified by:
        getCacheTxCommits in interface CacheMetrics
        Returns:
        Number of transaction commits.
      • getCacheTxRollbacks

        public long getCacheTxRollbacks()
        Gets total number of transaction rollbacks.
        Specified by:
        getCacheTxRollbacks in interface CacheMetrics
        Returns:
        Number of transaction rollbacks.
      • name

        public String name()
        Gets name of this cache.
        Specified by:
        name in interface CacheMetrics
        Returns:
        Cache name.
      • getOffHeapGets

        public long getOffHeapGets()
        The total number of get requests to the off-heap memory.
        Specified by:
        getOffHeapGets in interface CacheMetrics
        Returns:
        The number of gets.
      • getOffHeapPuts

        public long getOffHeapPuts()
        The total number of put requests to the off-heap memory.
        Specified by:
        getOffHeapPuts in interface CacheMetrics
        Returns:
        The number of puts.
      • getOffHeapRemovals

        public long getOffHeapRemovals()
        The total number of removals from the off-heap memory. This does not include evictions.
        Specified by:
        getOffHeapRemovals in interface CacheMetrics
        Returns:
        The number of removals.
      • getOffHeapEvictions

        public long getOffHeapEvictions()
        The total number of evictions from the off-heap memory.
        Specified by:
        getOffHeapEvictions in interface CacheMetrics
        Returns:
        The number of evictions.
      • getOffHeapHits

        public long getOffHeapHits()
        The number of get requests that were satisfied by the off-heap memory.
        Specified by:
        getOffHeapHits in interface CacheMetrics
        Returns:
        The off-heap hits number.
      • getOffHeapHitPercentage

        public float getOffHeapHitPercentage()
        Gets the percentage of hits on off-heap memory.
        Specified by:
        getOffHeapHitPercentage in interface CacheMetrics
        Returns:
        The percentage of hits on off-heap memory.
      • getOffHeapMisses

        public long getOffHeapMisses()
        A miss is a get request that is not satisfied by off-heap memory.
        Specified by:
        getOffHeapMisses in interface CacheMetrics
        Returns:
        The off-heap misses number.
      • getOffHeapMissPercentage

        public float getOffHeapMissPercentage()
        Gets the percentage of misses on off-heap memory.
        Specified by:
        getOffHeapMissPercentage in interface CacheMetrics
        Returns:
        The percentage of misses on off-heap memory.
      • getOffHeapEntriesCount

        public long getOffHeapEntriesCount()
        Gets number of entries stored in off-heap memory.
        Specified by:
        getOffHeapEntriesCount in interface CacheMetrics
        Returns:
        Number of entries stored in off-heap memory.
      • getHeapEntriesCount

        public long getHeapEntriesCount()
        Gets the number of cache entries in heap memory, including entries held by active transactions, entries in onheap cache and near entries.
        Specified by:
        getHeapEntriesCount in interface CacheMetrics
        Returns:
        Number of entries in heap memory.
      • getOffHeapPrimaryEntriesCount

        public long getOffHeapPrimaryEntriesCount()
        Gets number of primary entries stored in off-heap memory.
        Specified by:
        getOffHeapPrimaryEntriesCount in interface CacheMetrics
        Returns:
        Number of primary entries stored in off-heap memory.
      • getOffHeapBackupEntriesCount

        public long getOffHeapBackupEntriesCount()
        Gets number of backup entries stored in off-heap memory.
        Specified by:
        getOffHeapBackupEntriesCount in interface CacheMetrics
        Returns:
        Number of backup entries stored in off-heap memory.
      • getOffHeapAllocatedSize

        public long getOffHeapAllocatedSize()
        Gets memory size allocated in off-heap.
        Specified by:
        getOffHeapAllocatedSize in interface CacheMetrics
        Returns:
        Memory size allocated in off-heap.
      • getSize

        public int getSize()
        Gets number of non-null values in the cache. Note this method will always return 0
        Specified by:
        getSize in interface CacheMetrics
        Returns:
        Number of non-null values in the cache.
      • getCacheSize

        public long getCacheSize()
        Cache size.
        Specified by:
        getCacheSize in interface CacheMetrics
        Returns:
        Cache size.
      • getKeySize

        public int getKeySize()
        Gets number of keys in the cache, possibly with null values. Note this method will always return 0
        Specified by:
        getKeySize in interface CacheMetrics
        Returns:
        Number of keys in the cache.
      • isEmpty

        public boolean isEmpty()
        Returns true if this cache is empty.
        Specified by:
        isEmpty in interface CacheMetrics
        Returns:
        True if this cache is empty.
      • getDhtEvictQueueCurrentSize

        public int getDhtEvictQueueCurrentSize()
        Gets current size of evict queue used to batch up evictions.
        Specified by:
        getDhtEvictQueueCurrentSize in interface CacheMetrics
        Returns:
        Current size of evict queue.
      • getTxThreadMapSize

        public int getTxThreadMapSize()
        Gets transaction per-thread map size.
        Specified by:
        getTxThreadMapSize in interface CacheMetrics
        Returns:
        Thread map size.
      • getTxXidMapSize

        public int getTxXidMapSize()
        Gets transaction per-Xid map size.
        Specified by:
        getTxXidMapSize in interface CacheMetrics
        Returns:
        Transaction per-Xid map size.
      • getTxCommitQueueSize

        public int getTxCommitQueueSize()
        Gets committed transaction queue size.
        Specified by:
        getTxCommitQueueSize in interface CacheMetrics
        Returns:
        Committed transaction queue size.
      • getTxPrepareQueueSize

        public int getTxPrepareQueueSize()
        Gets prepared transaction queue size.
        Specified by:
        getTxPrepareQueueSize in interface CacheMetrics
        Returns:
        Prepared transaction queue size.
      • getTxStartVersionCountsSize

        public int getTxStartVersionCountsSize()
        Gets start version counts map size.
        Specified by:
        getTxStartVersionCountsSize in interface CacheMetrics
        Returns:
        Start version counts map size.
      • getTxCommittedVersionsSize

        public int getTxCommittedVersionsSize()
        Gets number of cached committed transaction IDs.
        Specified by:
        getTxCommittedVersionsSize in interface CacheMetrics
        Returns:
        Number of cached committed transaction IDs.
      • getTxRolledbackVersionsSize

        public int getTxRolledbackVersionsSize()
        Gets number of cached rolled back transaction IDs.
        Specified by:
        getTxRolledbackVersionsSize in interface CacheMetrics
        Returns:
        Number of cached rolled back transaction IDs.
      • getTxDhtThreadMapSize

        public int getTxDhtThreadMapSize()
        Gets transaction DHT per-thread map size.
        Specified by:
        getTxDhtThreadMapSize in interface CacheMetrics
        Returns:
        DHT thread map size.
      • getTxDhtXidMapSize

        public int getTxDhtXidMapSize()
        Gets transaction DHT per-Xid map size.
        Specified by:
        getTxDhtXidMapSize in interface CacheMetrics
        Returns:
        Transaction DHT per-Xid map size.
      • getTxDhtCommitQueueSize

        public int getTxDhtCommitQueueSize()
        Gets committed DHT transaction queue size.
        Specified by:
        getTxDhtCommitQueueSize in interface CacheMetrics
        Returns:
        Committed DHT transaction queue size.
      • getTxDhtPrepareQueueSize

        public int getTxDhtPrepareQueueSize()
        Gets prepared DHT transaction queue size.
        Specified by:
        getTxDhtPrepareQueueSize in interface CacheMetrics
        Returns:
        Prepared DHT transaction queue size.
      • getTxDhtStartVersionCountsSize

        public int getTxDhtStartVersionCountsSize()
        Gets DHT start version counts map size.
        Specified by:
        getTxDhtStartVersionCountsSize in interface CacheMetrics
        Returns:
        DHT start version counts map size.
      • getTxDhtCommittedVersionsSize

        public int getTxDhtCommittedVersionsSize()
        Gets number of cached committed DHT transaction IDs.
        Specified by:
        getTxDhtCommittedVersionsSize in interface CacheMetrics
        Returns:
        Number of cached committed DHT transaction IDs.
      • getTxDhtRolledbackVersionsSize

        public int getTxDhtRolledbackVersionsSize()
        Gets number of cached rolled back DHT transaction IDs.
        Specified by:
        getTxDhtRolledbackVersionsSize in interface CacheMetrics
        Returns:
        Number of cached rolled back DHT transaction IDs.
      • getTotalPartitionsCount

        public int getTotalPartitionsCount()
        Specified by:
        getTotalPartitionsCount in interface CacheMetrics
        Returns:
        Total number of partitions on current node.
      • getRebalancedKeys

        public long getRebalancedKeys()
        Specified by:
        getRebalancedKeys in interface CacheMetrics
        Returns:
        Number of already rebalanced keys.
      • getRebalancingPartitionsCount

        public int getRebalancingPartitionsCount()
        Specified by:
        getRebalancingPartitionsCount in interface CacheMetrics
        Returns:
        Number of currently rebalancing partitions on current node.
      • getKeysToRebalanceLeft

        public long getKeysToRebalanceLeft()
        Specified by:
        getKeysToRebalanceLeft in interface CacheMetrics
        Returns:
        Estimated number of keys to be rebalanced on current node.
      • getRebalancingKeysRate

        public long getRebalancingKeysRate()
        Specified by:
        getRebalancingKeysRate in interface CacheMetrics
        Returns:
        Estimated rebalancing speed in keys.
      • getRebalancingBytesRate

        public long getRebalancingBytesRate()
        Specified by:
        getRebalancingBytesRate in interface CacheMetrics
        Returns:
        Estimated rebalancing speed in bytes.
      • getRebalanceClearingPartitionsLeft

        public long getRebalanceClearingPartitionsLeft()
        Specified by:
        getRebalanceClearingPartitionsLeft in interface CacheMetrics
        Returns:
        The number of partitions need to be cleared before actual rebalance start.
      • isWriteBehindEnabled

        public boolean isWriteBehindEnabled()
        Returns true if write-behind is enabled.
        Specified by:
        isWriteBehindEnabled in interface CacheMetrics
        Returns:
        True if write-behind is enabled.
      • getWriteBehindFlushSize

        public int getWriteBehindFlushSize()
        Gets the maximum size of the write-behind buffer. When the count of unique keys in write buffer exceeds this value, the buffer is scheduled for write to the underlying store.

        If this value is 0, then flush is performed only on time-elapsing basis. However, when this value is 0, the cache critical size is set to CacheConfiguration.DFLT_WRITE_BEHIND_CRITICAL_SIZE

        Specified by:
        getWriteBehindFlushSize in interface CacheMetrics
        Returns:
        Buffer size that triggers flush procedure.
      • getWriteBehindFlushThreadCount

        public int getWriteBehindFlushThreadCount()
        Gets the number of flush threads that will perform store update operations.
        Specified by:
        getWriteBehindFlushThreadCount in interface CacheMetrics
        Returns:
        Count of worker threads.
      • getWriteBehindFlushFrequency

        public long getWriteBehindFlushFrequency()
        Gets the cache flush frequency. All pending operations on the underlying store will be performed within time interval not less then this value.

        If this value is 0, then flush is performed only when buffer size exceeds flush size.

        Specified by:
        getWriteBehindFlushFrequency in interface CacheMetrics
        Returns:
        Flush frequency in milliseconds.
      • getWriteBehindStoreBatchSize

        public int getWriteBehindStoreBatchSize()
        Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
        Specified by:
        getWriteBehindStoreBatchSize in interface CacheMetrics
        Returns:
        Maximum size of batch.
      • getWriteBehindTotalCriticalOverflowCount

        public int getWriteBehindTotalCriticalOverflowCount()
        Gets count of write buffer overflow events since initialization. Each overflow event causes the ongoing flush operation to be performed synchronously.
        Specified by:
        getWriteBehindTotalCriticalOverflowCount in interface CacheMetrics
        Returns:
        Count of cache overflow events since start.
      • getWriteBehindCriticalOverflowCount

        public int getWriteBehindCriticalOverflowCount()
        Gets count of write buffer overflow events in progress at the moment. Each overflow event causes the ongoing flush operation to be performed synchronously.
        Specified by:
        getWriteBehindCriticalOverflowCount in interface CacheMetrics
        Returns:
        Count of cache overflow events since start.
      • getWriteBehindErrorRetryCount

        public int getWriteBehindErrorRetryCount()
        Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state when underlying store failed due some reason and cache has enough space to retain this entry till the next try.
        Specified by:
        getWriteBehindErrorRetryCount in interface CacheMetrics
        Returns:
        Count of entries in store-retry state.
      • getWriteBehindBufferSize

        public int getWriteBehindBufferSize()
        Gets count of entries that were processed by the write-behind store and have not been flushed to the underlying store yet.
        Specified by:
        getWriteBehindBufferSize in interface CacheMetrics
        Returns:
        Total count of entries in cache store internal buffer.
      • getKeyType

        public String getKeyType()
        Determines the required type of keys for this Cache, if any.
        Specified by:
        getKeyType in interface CacheMetrics
        Returns:
        The fully qualified class name of the key type, or "java.lang.Object" if the type is undefined.
      • getValueType

        public String getValueType()
        Determines the required type of values for this Cache, if any.
        Specified by:
        getValueType in interface CacheMetrics
        Returns:
        The fully qualified class name of the value type, or "java.lang.Object" if the type is undefined.
      • isStoreByValue

        public boolean isStoreByValue()
        Whether storeByValue true or storeByReference false. When true, both keys and values are stored by value.

        When false, both keys and values are stored by reference. Caches stored by reference are capable of mutation by any threads holding the reference. The effects are:

        • if the key is mutated, then the key may not be retrievable or removable
        • if the value is mutated, then all threads in the JVM can potentially observe those mutations, subject to the normal Java Memory Model rules.
        Storage by reference only applies to the local heap. If an entry is moved off heap it will need to be transformed into a representation. Any mutations that occur after transformation may not be reflected in the cache.

        When a cache is storeByValue, any mutation to the key or value does not affect the key of value stored in the cache.

        The default value is true.

        Specified by:
        isStoreByValue in interface CacheMetrics
        Returns:
        True if the cache is store by value.
      • isStatisticsEnabled

        public boolean isStatisticsEnabled()
        Checks whether statistics collection is enabled in this cache.

        The default value is false.

        Specified by:
        isStatisticsEnabled in interface CacheMetrics
        Returns:
        True if statistics collection is enabled.
      • isManagementEnabled

        public boolean isManagementEnabled()
        Checks whether management is enabled on this cache.

        The default value is false.

        Specified by:
        isManagementEnabled in interface CacheMetrics
        Returns:
        true if management is enabled.
      • isReadThrough

        public boolean isReadThrough()
        Determines if a Cache should operate in read-through mode.

        The default value is false

        Specified by:
        isReadThrough in interface CacheMetrics
        Returns:
        True when a Cache is in "read-through" mode.
        See Also:
        CacheLoader
      • isWriteThrough

        public boolean isWriteThrough()
        Determines if a Cache should operate in "write-through" mode.

        will appropriately cause the configured CacheWriter to be invoked.

        The default value is false

        Specified by:
        isWriteThrough in interface CacheMetrics
        Returns:
        True when a Cache is in "write-through" mode.
        See Also:
        CacheWriter
      • isValidForReading

        public boolean isValidForReading()
        Checks whether cache topology is valid for read operations.

        Note: the method will return false if any partition was lost despite the fact others can be awailable for reading.

        Specified by:
        isValidForReading in interface CacheMetrics
        Returns:
        true when cache topology is valid for reading.
      • isValidForWriting

        public boolean isValidForWriting()
        Checks whether cache topology is valid for write operations.

        Note: the method will return false if any partition was lost despite the fact others can be awailable for writing according to configured partition loss policy.

        Specified by:
        isValidForWriting in interface CacheMetrics
        Returns:
        true when cache topology is valid for writing.
      • isIndexRebuildInProgress

        public boolean isIndexRebuildInProgress()
        Return true if index rebuild is in progress.
        Specified by:
        isIndexRebuildInProgress in interface CacheMetrics
        Returns:
        true if index rebuild is in progress.
      • getIndexRebuildKeysProcessed

        public long getIndexRebuildKeysProcessed()
        Return number of keys processed during index rebuilding. To get remaining number of keys for rebuilding, subtract current value from CacheMetrics.getCacheSize().
        Specified by:
        getIndexRebuildKeysProcessed in interface CacheMetrics
        Returns:
        Number of keys processed during index rebuilding.
      • getIndexBuildPartitionsLeftCount

        public int getIndexBuildPartitionsLeftCount()
        Specified by:
        getIndexBuildPartitionsLeftCount in interface CacheMetrics
        Returns:
        The number of partitions that remain to be processed to complete indexing. Note that this metric includes backup partitions, which also participate in index building on each node.