Package org.infinispan.stats.impl
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
protected long
protected long
Fields inherited from interface org.infinispan.stats.ClusterCacheStats
OBJECT_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
long
Returns the approximate number of entries in this cache that exist in memory or persistent storage.long
The same asStats.getApproximateEntries()
, however passivated entries are not included.long
The same asStats.getApproximateEntries()
, however only entries owned as primary are counted.long
long
long
long
long
long
long
long
int
Returns the number of entries currently in this cache instance.int
The same asStats.getCurrentNumberOfEntries()
, however passivated entries are not included.long
Provides how much memory the current eviction algorithm estimates is in use for data.long
double
long
getHits()
long
long
int
int
int
long
The amount of off-heap memory used by this cache, or -1 if the cache stores data in the heap.long
double
long
long
int
long
long
protected Number
boolean
Returns whether an interceptor's statistics are being captured.long
long
long
void
reset()
Reset statisticsvoid
Resets an interceptor's cache statisticsvoid
setStaleStatsThreshold
(long threshold) void
setStaleStatsThreshold
(long staleStatsThreshold) void
setStatisticsEnabled
(boolean enabled) Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.void
start()
Methods inherited from class org.infinispan.stats.impl.AbstractClusterStats
getStaleStatsThreshold, getTimeSinceReset, isStatisticsEnabled
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.stats.Stats
getTimeSinceReset, setStatisticsEnabled, toJson
-
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 interfaceStats
- 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 interfaceStats
- 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 interfaceStats
- 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 interfaceStats
- 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 interfaceStats
- 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 interfaceStats
- 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 interfaceStats
- 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 interfaceStats
- 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() -
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 interfaceClusterCacheStats
- 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() -
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 interfaceClusterCacheStats
- Specified by:
getApproximateEntries
in interfaceStats
- 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 asStats.getApproximateEntries()
, however passivated entries are not included.- Specified by:
getApproximateEntriesInMemory
in interfaceClusterCacheStats
- Specified by:
getApproximateEntriesInMemory
in interfaceStats
- 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 asStats.getApproximateEntries()
, however only entries owned as primary are counted. This is only different fromStats.getApproximateEntries()
only in distributed and replicated caches.- Specified by:
getApproximateEntriesUnique
in interfaceClusterCacheStats
- Specified by:
getApproximateEntriesUnique
in interfaceStats
- 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 asStats.getCurrentNumberOfEntries()
, however passivated entries are not included.- Specified by:
getCurrentNumberOfEntriesInMemory
in interfaceStats
-
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 interfaceClusterCacheStats
- 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 interfaceStats
- 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 interfaceStats
- 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() -
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 interfaceStats
- 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 interfaceStats
- Returns:
- Number of entries currently in the cache, including passivated entries.
-
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 interfaceStats
- 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 interfaceStats
-
getRetrievals
public long getRetrievals()- Specified by:
getRetrievals
in interfaceStats
- Returns:
- Number of entries read from the cache since start.
-
reset
public void reset()Description copied from interface:Stats
Reset statistics -
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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceClusterCacheStats
- 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 interfaceJmxStatisticsExposer
-
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 interfaceJmxStatisticsExposer
- 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 interfaceJmxStatisticsExposer
- Returns:
- true if statistics are captured
-
setStaleStatsThreshold
public void setStaleStatsThreshold(long staleStatsThreshold) -
getStat
-