Package org.infinispan.stats.impl
Class StatsCollector
java.lang.Object
org.infinispan.stats.impl.StatsCollector
- All Implemented Interfaces:
JsonSerialization
,JmxStatisticsExposer
,Stats
@MBean(objectName="Statistics",
description="General statistics such as timings, hit/miss ratio, etc.")
public final class StatsCollector
extends Object
implements Stats, JmxStatisticsExposer
- Author:
- Radim Vansa <rvansa@redhat.com>
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
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
int
Returns the number of entries currently in this cache instance.int
Deprecated, for removal: This API element is subject to removal in a future version.long
Provides how much memory the current eviction algorithm estimates is in use for data.long
double
long
getHits()
long
int
Deprecated, for removal: This API element is subject to removal in a future version.long
The amount of off-heap memory used by this cache, or -1 if the cache stores data in the heap.double
long
long
int
long
boolean
Returns whether an interceptor's statistics are being captured.long
long
long
void
void
recordEvictions
(int evicted) void
recordHits
(int hits, long time) void
recordMisses
(int misses, long time) void
recordRemoveHits
(int removes, long time) void
recordRemoveMisses
(int removes) void
recordStores
(int stores, long time) void
reset()
Reset statisticsvoid
Resets an interceptor's cache statisticsvoid
setStatisticsEnabled
(boolean enabled) Enables or disables statistics at runtime.void
start()
toJson()
-
Field Details
-
SEGMENT_0
-
-
Constructor Details
-
StatsCollector
public StatsCollector()
-
-
Method Details
-
start
public void start() -
getHits
@ManagedAttribute(description="Number of cache attribute hits", displayName="Number of cache hits", measurementType=TRENDSUP) public long getHits() -
getMisses
@ManagedAttribute(description="Number of cache attribute misses", displayName="Number of cache misses", measurementType=TRENDSUP) public long getMisses() -
getRemoveHits
@ManagedAttribute(description="Number of cache removal hits", displayName="Number of cache removal hits", measurementType=TRENDSUP) public long getRemoveHits()- Specified by:
getRemoveHits
in interfaceStats
- Returns:
- Number of cache removal hits.
-
getRemoveMisses
@ManagedAttribute(description="Number of cache removals where keys were not found", displayName="Number of cache removal misses", measurementType=TRENDSUP) public long getRemoveMisses()- Specified by:
getRemoveMisses
in interfaceStats
- Returns:
- Number of cache removal misses.
-
getStores
@ManagedAttribute(description="Number of cache attribute put operations", displayName="Number of cache puts", measurementType=TRENDSUP) public long getStores() -
getRetrievals
public long getRetrievals()- Specified by:
getRetrievals
in interfaceStats
- Returns:
- Number of entries read from the cache since start.
-
getEvictions
@ManagedAttribute(description="Number of cache eviction operations", displayName="Number of cache evictions", measurementType=TRENDSUP) public long getEvictions()- Specified by:
getEvictions
in interfaceStats
- Returns:
- Number of cache eviction.
-
getHitRatio
@ManagedAttribute(description="Percentage hit/(hit+miss) ratio for the cache", displayName="Hit ratio", units=PERCENTAGE) public double getHitRatio() -
getReadWriteRatio
@ManagedAttribute(description="Read/writes ratio for the cache", displayName="Read/write ratio", units=PERCENTAGE) public double getReadWriteRatio() -
getAverageReadTime
@ManagedAttribute(description="Average number of milliseconds for a read operation on the cache", displayName="Average read time", units=MILLISECONDS) 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", displayName="Average read time (ns)", units=NANOSECONDS) public long getAverageReadTimeNanos()- Specified by:
getAverageReadTimeNanos
in interfaceStats
- Returns:
- Average number of nanoseconds for a cache get on the cache
-
getAverageWriteTime
@ManagedAttribute(description="Average number of milliseconds for a write operation in the cache", displayName="Average write time", units=MILLISECONDS) 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", displayName="Average write time (ns)", units=NANOSECONDS) public long getAverageWriteTimeNanos()- Specified by:
getAverageWriteTimeNanos
in interfaceStats
- Returns:
- Average number of milliseconds for a cache put on the cache
-
getAverageRemoveTime
@ManagedAttribute(description="Average number of milliseconds for a remove operation in the cache", displayName="Average remove time", units=MILLISECONDS) 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", displayName="Average remove time (ns)", units=NANOSECONDS) public long getAverageRemoveTimeNanos()- Specified by:
getAverageRemoveTimeNanos
in interfaceStats
- Returns:
- Average number of nanoseconds for a cache remove on the cache
-
getRequiredMinimumNumberOfNodes
@ManagedAttribute(description="Required minimum number of nodes to hold current cache data", displayName="Required minimum number of nodes") public int getRequiredMinimumNumberOfNodes()- Specified by:
getRequiredMinimumNumberOfNodes
in interfaceStats
- Returns:
- Required minimum number of nodes to guarantee data consistency
-
reset
public void reset()Description copied from interface:Stats
Reset statistics -
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
-
setStatisticsEnabled
@ManagedAttribute(description="Enables or disables the gathering of statistics by this component", writable=true) public void setStatisticsEnabled(boolean enabled) Description copied from interface:Stats
Enables or disables statistics at runtime.- Specified by:
setStatisticsEnabled
in interfaceJmxStatisticsExposer
- Specified by:
setStatisticsEnabled
in interfaceStats
- Parameters:
enabled
- boolean indicating whether statistics should be enable or not
-
getNumberOfEntries
@ManagedAttribute(description="Number of entries in the cache including passivated entries", displayName="Number of current cache entries") @Deprecated(forRemoval=true, since="14.0") public int getNumberOfEntries()Deprecated, for removal: This API element is subject to removal in a future version. -
getCurrentNumberOfEntriesInMemory
@ManagedAttribute(description="Number of entries currently in-memory excluding expired entries", displayName="Number of in-memory cache entries") @Deprecated(forRemoval=true, since="14.0") public int getCurrentNumberOfEntriesInMemory()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:Stats
The same asStats.getCurrentNumberOfEntries()
, however passivated entries are not included.- Specified by:
getCurrentNumberOfEntriesInMemory
in interfaceStats
-
getTimeSinceStart
@ManagedAttribute(description="Number of seconds since cache started", displayName="Seconds since cache started", units=SECONDS, measurementType=TRENDSUP) public long getTimeSinceStart()- Specified by:
getTimeSinceStart
in interfaceStats
- Returns:
- Number of seconds since cache started.
-
getTimeSinceReset
@ManagedAttribute(description="Number of seconds since the cache statistics were last reset", displayName="Seconds since cache statistics were reset", units=SECONDS) public long getTimeSinceReset()- Specified by:
getTimeSinceReset
in interfaceStats
- Returns:
- Number of seconds since stats where reset
-
getApproximateEntries
@ManagedAttribute(description="Approximate current number of entries in the cache, including persisted and expired entries.", displayName="Approximate number of entries") 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 interfaceStats
- Returns:
- Number of entries currently in the cache, including passivated entries.
-
getApproximateEntriesInMemory
@ManagedAttribute(description="Approximate current number of entries in memory, including expired entries.", displayName="Approximate number of cache entries in memory") public long getApproximateEntriesInMemory()Description copied from interface:Stats
The same asStats.getApproximateEntries()
, however passivated entries are not included.- Specified by:
getApproximateEntriesInMemory
in interfaceStats
-
getApproximateEntriesUnique
@ManagedAttribute(description="Approximate current number of entries in the cache, including persisted and expired entries.", displayName="Approximate number of entries") 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 interfaceStats
-
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 of memory in bytes allocated for use in eviction for data in the cache", displayName="Memory used by data in the cache") 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 off-heap memory used by this cache (bytes)", displayName="Off-Heap memory used") 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
-
resetStatistics
@ManagedOperation(description="Resets statistics gathered by this component", displayName="Reset Statistics (Statistics)") public void resetStatistics()Description copied from interface:JmxStatisticsExposer
Resets an interceptor's cache statistics- Specified by:
resetStatistics
in interfaceJmxStatisticsExposer
-
recordMisses
public void recordMisses(int misses, long time) -
recordHits
public void recordHits(int hits, long time) -
recordEviction
public void recordEviction() -
recordEvictions
public void recordEvictions(int evicted) -
recordStores
public void recordStores(int stores, long time) -
recordRemoveHits
public void recordRemoveHits(int removes, long time) -
recordRemoveMisses
public void recordRemoveMisses(int removes) -
toJson
- Specified by:
toJson
in interfaceJsonSerialization
- Specified by:
toJson
in interfaceStats
-