Class ClusterCacheStatsImpl

java.lang.Object
org.infinispan.stats.impl.AbstractClusterStats
org.infinispan.stats.impl.ClusterCacheStatsImpl
All Implemented Interfaces:
JsonSerialization, JmxStatisticsExposer, ClusterCacheStats, Stats

@MBean(objectName="ClusterCacheStats", description="General cluster statistics such as timings, hit/miss ratio, etc. for a cache.") public class ClusterCacheStatsImpl extends AbstractClusterStats implements ClusterCacheStats
  • Field Details

    • DEFAULT_STALE_STATS_THRESHOLD

      public static final long DEFAULT_STALE_STATS_THRESHOLD
      See Also:
    • staleStatsThreshold

      protected volatile long staleStatsThreshold
    • statsUpdateTimestamp

      protected volatile long statsUpdateTimestamp
  • Constructor Details

    • ClusterCacheStatsImpl

      public ClusterCacheStatsImpl()
  • Method Details

    • start

      public void start()
    • getAverageReadTime

      @ManagedAttribute(description="Average number of milliseconds for a read operation on the cache across the cluster", displayName="Cluster-wide total average read time (ms)", units=MILLISECONDS, clusterWide=true) public long getAverageReadTime()
      Specified by:
      getAverageReadTime in interface Stats
      Returns:
      Average number of milliseconds for a cache get on the cache
    • getAverageReadTimeNanos

      @ManagedAttribute(description="Average number of nanoseconds for a read operation on the cache across the cluster", displayName="Cluster-wide average read time (ns)", units=NANOSECONDS, clusterWide=true) public long getAverageReadTimeNanos()
      Specified by:
      getAverageReadTimeNanos in interface Stats
      Returns:
      Average number of nanoseconds for a cache get on the cache
    • getAverageRemoveTime

      @ManagedAttribute(description="Average number of milliseconds for a remove operation in the cache across the cluster", displayName="Cluster-wide average remove time (ms)", units=MILLISECONDS, clusterWide=true) public long getAverageRemoveTime()
      Specified by:
      getAverageRemoveTime in interface Stats
      Returns:
      Average number of milliseconds for a cache remove on the cache
    • getAverageRemoveTimeNanos

      @ManagedAttribute(description="Average number of nanoseconds for a remove operation in the cache across the cluster", displayName="Cluster-wide average remove time (ns)", units=NANOSECONDS, clusterWide=true) public long getAverageRemoveTimeNanos()
      Specified by:
      getAverageRemoveTimeNanos in interface Stats
      Returns:
      Average number of nanoseconds for a cache remove on the cache
    • getAverageWriteTime

      @ManagedAttribute(description="Average number of milliseconds for a write operation in the cache across the cluster", displayName="Cluster-wide average write time (ms)", units=MILLISECONDS, clusterWide=true) public long getAverageWriteTime()
      Specified by:
      getAverageWriteTime in interface Stats
      Returns:
      Average number of milliseconds for a cache put on the cache
    • getAverageWriteTimeNanos

      @ManagedAttribute(description="Average number of nanoseconds for a write operation in the cache across the cluster", displayName="Cluster-wide average write time (ns)", units=NANOSECONDS, clusterWide=true) public long getAverageWriteTimeNanos()
      Specified by:
      getAverageWriteTimeNanos in interface Stats
      Returns:
      Average number of milliseconds for a cache put on the cache
    • getRequiredMinimumNumberOfNodes

      @ManagedAttribute(description="Minimum number of nodes to avoid losing data", displayName="Required minimum number of nodes", clusterWide=true) public int getRequiredMinimumNumberOfNodes()
      Specified by:
      getRequiredMinimumNumberOfNodes in interface Stats
      Returns:
      Required minimum number of nodes to guarantee data consistency
    • getEvictions

      @ManagedAttribute(description="Total number of cache eviction operations across the cluster", displayName="Cluster-wide total number of cache evictions", measurementType=TRENDSUP, clusterWide=true) public long getEvictions()
      Specified by:
      getEvictions in interface Stats
      Returns:
      Number of cache eviction.
    • getHits

      @ManagedAttribute(description="Total number of cache read hits across the cluster", displayName="Cluster-wide total number of cache read hits", measurementType=TRENDSUP, clusterWide=true) public long getHits()
      Specified by:
      getHits in interface Stats
      Returns:
      Number of cache get hits.
    • getHitRatio

      @ManagedAttribute(description="Percentage hit/(hit+miss) ratio for this cache", displayName="Cluster-wide hit ratio", units=PERCENTAGE, clusterWide=true) public double getHitRatio()
      Specified by:
      getHitRatio in interface ClusterCacheStats
      Returns:
      cluster wide total percentage hit/(hit+miss) ratio for this cache
    • getMisses

      @ManagedAttribute(description="Total number of cache read misses", displayName="Cluster-wide number of cache read misses", measurementType=TRENDSUP, clusterWide=true) public long getMisses()
      Specified by:
      getMisses in interface Stats
      Returns:
      Number of cache get misses.
    • getApproximateEntries

      @ManagedAttribute(description="Approximate number of entry replicas in the cache across the cluster, including passivated entries", displayName="Cluster-wide approximate number of entry replicas", clusterWide=true) public long getApproximateEntries()
      Description copied from interface: Stats
      Returns the approximate number of entries in this cache that exist in memory or persistent storage. When the cache is configured with distribution, this method only returns the number of entries in the local cache instance. In other words, it does not communicate with other nodes to find out about data stored in the cluster and not available locally.
      Specified by:
      getApproximateEntries in interface ClusterCacheStats
      Specified by:
      getApproximateEntries in interface Stats
      Returns:
      the approximate number of entries. Each owner's copy is counted separately, except entries in shared stores.
    • getApproximateEntriesInMemory

      @ManagedAttribute(description="Approximate number of entry replicas in memory across the cluster", displayName="Cluster-wide approximate number of entry replicas in memory", clusterWide=true) public long getApproximateEntriesInMemory()
      Description copied from interface: Stats
      The same as Stats.getApproximateEntries(), however passivated entries are not included.
      Specified by:
      getApproximateEntriesInMemory in interface ClusterCacheStats
      Specified by:
      getApproximateEntriesInMemory in interface Stats
      Returns:
      the approximate number of entries in memory. Each owner's copy is counted separately.
    • getApproximateEntriesUnique

      @ManagedAttribute(description="Approximate number of unique entries in the cache across the cluster, ignoring duplicate replicas", displayName="Cluster-wide approximate number of unique entries", clusterWide=true) public long getApproximateEntriesUnique()
      Description copied from interface: Stats
      The same as Stats.getApproximateEntries(), however only entries owned as primary are counted. This is only different from Stats.getApproximateEntries() only in distributed and replicated caches.
      Specified by:
      getApproximateEntriesUnique in interface ClusterCacheStats
      Specified by:
      getApproximateEntriesUnique in interface Stats
      Returns:
      the approximate number of unique entries.
    • getNumberOfEntries

      @ManagedAttribute(description="Current number of entries in the cache across the cluster, including passivated entries", displayName="Cluster-wide number of current cache entries", clusterWide=true) public int getNumberOfEntries()
    • getCurrentNumberOfEntriesInMemory

      @ManagedAttribute(description="Current number of entries in memory across the cluster", displayName="Cluster-wide number of entries in memory", clusterWide=true) public int getCurrentNumberOfEntriesInMemory()
      Description copied from interface: Stats
      The same as Stats.getCurrentNumberOfEntries(), however passivated entries are not included.
      Specified by:
      getCurrentNumberOfEntriesInMemory in interface Stats
    • getReadWriteRatio

      @ManagedAttribute(description="Cluster-wide read/writes ratio for the cache", displayName="Cluster-wide read/write ratio", units=PERCENTAGE, clusterWide=true) public double getReadWriteRatio()
      Specified by:
      getReadWriteRatio in interface ClusterCacheStats
      Returns:
      cluster wide read/writes ratio for the cache
    • getRemoveHits

      @ManagedAttribute(description="Cluster-wide total number of cache removal hits", displayName="Cluster-wide total number of cache removal hits", measurementType=TRENDSUP, clusterWide=true) public long getRemoveHits()
      Specified by:
      getRemoveHits in interface Stats
      Returns:
      Number of cache removal hits.
    • getRemoveMisses

      @ManagedAttribute(description="Cluster-wide total number of cache removals where keys were not found", displayName="Cluster-wide total number of cache removal misses", measurementType=TRENDSUP, clusterWide=true) public long getRemoveMisses()
      Specified by:
      getRemoveMisses in interface Stats
      Returns:
      Number of cache removal misses.
    • getStores

      @ManagedAttribute(description="Cluster-wide total number of cache put operations", displayName="Cluster-wide total number of cache puts", measurementType=TRENDSUP, clusterWide=true) public long getStores()
      Specified by:
      getStores in interface Stats
      Returns:
      Number of entries stored in cache since start.
    • getTimeSinceStart

      @ManagedAttribute(description="Number of seconds since the first cache node started", displayName="Number of seconds since the first cache node started", measurementType=TRENDSUP, clusterWide=true) public long getTimeSinceStart()
      Specified by:
      getTimeSinceStart in interface Stats
      Returns:
      Number of seconds since cache started.
    • getCurrentNumberOfEntries

      public int getCurrentNumberOfEntries()
      Description copied from interface: Stats
      Returns the number of entries currently in this cache instance. When the cache is configured with distribution, this method only returns the number of entries in the local cache instance. In other words, it does not attempt to communicate with other nodes to find out about the data stored in other nodes in the cluster that is not available locally.
      Specified by:
      getCurrentNumberOfEntries in interface Stats
      Returns:
      Number of entries currently in the cache, including passivated entries.
    • getTotalNumberOfEntries

      @Deprecated(forRemoval=true) public long getTotalNumberOfEntries()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Stats
      Number of entries stored in cache since the cache started running.
      Specified by:
      getTotalNumberOfEntries in interface Stats
    • getDataMemoryUsed

      @ManagedAttribute(description="Amount in bytes of memory used across the cluster for entries in this cache with eviction", displayName="Cluster-wide memory used by eviction", clusterWide=true) public long getDataMemoryUsed()
      Description copied from interface: Stats
      Provides how much memory the current eviction algorithm estimates is in use for data. This method will return a number 0 or greater if memory eviction is in use. If memory eviction is not enabled this method will always return -1.
      Specified by:
      getDataMemoryUsed in interface Stats
      Returns:
      memory in use or -1 if memory eviction is not enabled
    • getOffHeapMemoryUsed

      @ManagedAttribute(description="Amount in bytes of off-heap memory used across the cluster for this cache", displayName="Cluster-wide off-heap memory used", clusterWide=true) public long getOffHeapMemoryUsed()
      Description copied from interface: Stats
      The amount of off-heap memory used by this cache, or -1 if the cache stores data in the heap.
      Specified by:
      getOffHeapMemoryUsed in interface Stats
    • getRetrievals

      public long getRetrievals()
      Specified by:
      getRetrievals in interface Stats
      Returns:
      Number of entries read from the cache since start.
    • reset

      public void reset()
      Description copied from interface: Stats
      Reset statistics
      Specified by:
      reset in interface Stats
    • getNumberOfLocksAvailable

      @ManagedAttribute(description="Current number of exclusive locks available across the cluster", displayName="Cluster-wide number of locks available", clusterWide=true) public int getNumberOfLocksAvailable()
      Specified by:
      getNumberOfLocksAvailable in interface ClusterCacheStats
      Returns:
      the total number of exclusive locks available in the cluster
    • getNumberOfLocksHeld

      @ManagedAttribute(description="Current number of locks held across the cluster", displayName="Cluster-wide number of locks held", clusterWide=true) public int getNumberOfLocksHeld()
      Specified by:
      getNumberOfLocksHeld in interface ClusterCacheStats
      Returns:
      the total number of exclusive locks held in the cluster
    • getInvalidations

      @ManagedAttribute(description="The total number of invalidations in the cluster", displayName="Cluster-wide total number of invalidations", measurementType=TRENDSUP, clusterWide=true) public long getInvalidations()
      Specified by:
      getInvalidations in interface ClusterCacheStats
      Returns:
      the total number of invalidations in the cluster
    • getActivations

      @ManagedAttribute(description="The total number of activations across the cluster", displayName="Cluster-wide total number of activations", measurementType=TRENDSUP, clusterWide=true) public long getActivations()
      Specified by:
      getActivations in interface ClusterCacheStats
      Returns:
      the total number of activations in the cluster
    • getPassivations

      @ManagedAttribute(description="The total number of passivations across the cluster", displayName="Cluster-wide total number of passivations", measurementType=TRENDSUP, clusterWide=true) public long getPassivations()
      Specified by:
      getPassivations in interface ClusterCacheStats
      Returns:
      the total number of passivations in the cluster
    • getCacheLoaderLoads

      @ManagedAttribute(description="The total number of persistence load operations in the cluster", displayName="Cluster-wide total number of persistence loads", measurementType=TRENDSUP, clusterWide=true) public long getCacheLoaderLoads()
      Specified by:
      getCacheLoaderLoads in interface ClusterCacheStats
      Returns:
      the total number of persistence load operations in the cluster
    • getCacheLoaderMisses

      @ManagedAttribute(description="The total number of cacheloader load misses in the cluster", displayName="Cluster-wide total number of cacheloader misses", measurementType=TRENDSUP, clusterWide=true) public long getCacheLoaderMisses()
      Specified by:
      getCacheLoaderMisses in interface ClusterCacheStats
      Returns:
      the total number of persistence misses in the cluster
    • getStoreWrites

      @ManagedAttribute(description="The total number of cachestore store operations in the cluster", displayName="Cluster-wide total number of cachestore stores", measurementType=TRENDSUP, clusterWide=true) public long getStoreWrites()
      Specified by:
      getStoreWrites in interface ClusterCacheStats
      Returns:
      the total number of persistence store operations in the cluster
    • getStaleStatsThreshold

      long getStaleStatsThreshold()
      Returns:
      The time in milliseconds, to wait between requests before re-retrieving cluster wide stats
    • setStaleStatsThreshold

      void setStaleStatsThreshold(long threshold)
      Parameters:
      threshold - the time in milliseconds, to wait between requests before re-retrieving cluster wide stats
    • resetStatistics

      @ManagedOperation(description="Resets statistics gathered by this component", displayName="Reset statistics") public void resetStatistics()
      Description copied from interface: JmxStatisticsExposer
      Resets an interceptor's cache statistics
      Specified by:
      resetStatistics in interface JmxStatisticsExposer
    • setStatisticsEnabled

      public void setStatisticsEnabled(boolean enabled)
      Description copied from interface: JmxStatisticsExposer
      Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.
      Specified by:
      setStatisticsEnabled in interface JmxStatisticsExposer
      Parameters:
      enabled - true if statistics should be captured
    • getStatisticsEnabled

      public boolean getStatisticsEnabled()
      Description copied from interface: JmxStatisticsExposer
      Returns whether an interceptor's statistics are being captured.
      Specified by:
      getStatisticsEnabled in interface JmxStatisticsExposer
      Returns:
      true if statistics are captured
    • setStaleStatsThreshold

      public void setStaleStatsThreshold(long staleStatsThreshold)
    • getStat

      protected Number getStat(String attribute)