Class PersistentCacheStats
- java.lang.Object
-
- javax.management.StandardMBean
-
- org.apache.jackrabbit.oak.commons.jmx.AnnotatedStandardMBean
-
- org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats
-
- All Implemented Interfaces:
DynamicMBean
,MBeanRegistration
,CacheStatsMBean
,PersistentCacheStatsMBean
public class PersistentCacheStats extends AnnotatedStandardMBean implements PersistentCacheStatsMBean
Persistence Cache Statistics.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean
TYPE
-
-
Constructor Summary
Constructors Constructor Description PersistentCacheStats(CacheType cacheType, StatisticsProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWriteGeneration(int generation)
String
cacheInfoAsString()
Gathers the stats of the cache for logging.long
estimateCurrentWeight()
Total weight of the complete cache.double
getAverageLoadPenalty()
Returns the average time spent loading new values.CompositeData
getBroadcastRecvRateHistory()
long
getElementCount()
Get the number of elements/objects in the cache.long
getEvictionCount()
Returns the number of times an entry has been evicted.long
getHitCount()
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have returned a cached value.CompositeData
getHitPercentageHistory()
double
getHitRate()
Returns the ratio of cache requests which were hits.CompositeData
getHitRateHistory()
CompositeData
getInvalidateAllRateHistory()
CompositeData
getInvalidateOneRateHistory()
long
getLoadCount()
Returns the total number of times thatorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods attempted to load new values.long
getLoadExceptionCount()
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods threw an exception while loading a new value.double
getLoadExceptionRate()
Returns the ratio of cache loading attempts which threw exceptions.CompositeData
getLoadExceptionRateHistory()
CompositeData
getLoadRateHistory()
long
getLoadSuccessCount()
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have successfully loaded a new value.long
getMaxTotalWeight()
The maximum weight of entries the cache may contain.long
getMissCount()
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have returned an uncached (newly loaded) value, or null.double
getMissRate()
Returns the ratio of cache requests which were misses.String
getName()
CompositeData
getPutRateHistory()
CompositeData
getPutRejectedAlreadyPersistedRateHistory()
CompositeData
getPutRejectedAsCachedInSecRateHistory()
CompositeData
getPutRejectedEntryNotUsedRateHistory()
CompositeData
getPutRejectedQueueFullRateHistory()
long
getRequestCount()
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have returned either a cached or uncached value.CompositeData
getRequestRateHistory()
long
getTotalLoadTime()
Returns the total number of nanoseconds the cache has spent loading new values.CompositeData
getUsedSpaceHistory()
void
markBytesWritten(long numBytes)
void
markException()
void
markHit()
void
markInvalidateAll()
void
markInvalidateOne()
void
markPut()
void
markPutRejectedAlreadyPersisted()
void
markPutRejectedAsCachedInSecondary()
void
markPutRejectedEntryNotUsed()
void
markPutRejectedQueueFull()
void
markRecvBroadcast()
void
markRequest()
void
removeReadGeneration(int generation)
void
resetStats()
Reset the cache statsTimerStats.Context
startLoaderTimer()
TimerStats.Context
startReadTimer()
-
Methods inherited from class org.apache.jackrabbit.oak.commons.jmx.AnnotatedStandardMBean
getDescription, getDescription, getDescription, getDescription, getImpact, getParameterName
-
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
-
-
-
-
Constructor Detail
-
PersistentCacheStats
public PersistentCacheStats(CacheType cacheType, StatisticsProvider provider)
-
-
Method Detail
-
markHit
public void markHit()
-
markRequest
public void markRequest()
-
markException
public void markException()
-
markPut
public void markPut()
-
markRecvBroadcast
public void markRecvBroadcast()
-
markInvalidateOne
public void markInvalidateOne()
-
markInvalidateAll
public void markInvalidateAll()
-
markPutRejectedAlreadyPersisted
public void markPutRejectedAlreadyPersisted()
-
markPutRejectedEntryNotUsed
public void markPutRejectedEntryNotUsed()
-
markPutRejectedAsCachedInSecondary
public void markPutRejectedAsCachedInSecondary()
-
markPutRejectedQueueFull
public void markPutRejectedQueueFull()
-
startReadTimer
public TimerStats.Context startReadTimer()
-
startLoaderTimer
public TimerStats.Context startLoaderTimer()
-
addWriteGeneration
public void addWriteGeneration(int generation)
-
removeReadGeneration
public void removeReadGeneration(int generation)
-
markBytesWritten
public void markBytesWritten(long numBytes)
-
getName
public String getName()
- Specified by:
getName
in interfaceCacheStatsMBean
-
getRequestCount
public long getRequestCount()
Description copied from interface:CacheStatsMBean
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have returned either a cached or uncached value. This is defined asgetHitCount + getMissCount
.- Specified by:
getRequestCount
in interfaceCacheStatsMBean
-
getHitCount
public long getHitCount()
Description copied from interface:CacheStatsMBean
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have returned a cached value.- Specified by:
getHitCount
in interfaceCacheStatsMBean
-
getHitRate
public double getHitRate()
Description copied from interface:CacheStatsMBean
Returns the ratio of cache requests which were hits. This is defined asgetHitCount / getRequestCount
, or1.0
whengetRequestCount == 0
. Note thatgetHitRate + getMissRate =~ 1.0
.- Specified by:
getHitRate
in interfaceCacheStatsMBean
-
getMissCount
public long getMissCount()
Description copied from interface:CacheStatsMBean
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have returned an uncached (newly loaded) value, or null. Multiple concurrent calls toorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods on an absent value can result in multiple misses, all returning the results of a single cache load operation.- Specified by:
getMissCount
in interfaceCacheStatsMBean
-
getMissRate
public double getMissRate()
Description copied from interface:CacheStatsMBean
Returns the ratio of cache requests which were misses. This is defined asgetMissCount / getRequestCount
, or0.0
whengetRequestCount == 0
. Note thatgetHitRate + getMissRate =~ 1.0
. Cache misses include all requests which weren't cache hits, including requests which resulted in either successful or failed loading attempts, and requests which waited for other threads to finish loading. It is thus the case thatgetMissCount >= getLoadSuccessCount + getLoadExceptionCount
. Multiple concurrent misses for the same key will result in a single load operation.- Specified by:
getMissRate
in interfaceCacheStatsMBean
-
getLoadCount
public long getLoadCount()
Description copied from interface:CacheStatsMBean
Returns the total number of times thatorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods attempted to load new values. This includes both successful load operations, as well as those that threw exceptions. This is defined asgetLoadSuccessCount + getLoadExceptionCount
.- Specified by:
getLoadCount
in interfaceCacheStatsMBean
-
getLoadSuccessCount
public long getLoadSuccessCount()
Description copied from interface:CacheStatsMBean
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods have successfully loaded a new value. This is always incremented in conjunction withCacheStatsMBean.getMissCount()
, thoughgetMissCount
is also incremented when an exception is encountered during cache loading (seeCacheStatsMBean.getLoadExceptionCount()
). Multiple concurrent misses for the same key will result in a single load operation.- Specified by:
getLoadSuccessCount
in interfaceCacheStatsMBean
-
getLoadExceptionCount
public long getLoadExceptionCount()
Description copied from interface:CacheStatsMBean
Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cache
lookup methods threw an exception while loading a new value. This is always incremented in conjunction withgetMissCount
, thoughgetMissCount
is also incremented when cache loading completes successfully (seeCacheStatsMBean.getLoadSuccessCount()
). Multiple concurrent misses for the same key will result in a single load operation.- Specified by:
getLoadExceptionCount
in interfaceCacheStatsMBean
-
getLoadExceptionRate
public double getLoadExceptionRate()
Description copied from interface:CacheStatsMBean
Returns the ratio of cache loading attempts which threw exceptions. This is defined asgetLoadExceptionCount / (getLoadSuccessCount + getLoadExceptionCount)
, or0.0
whengetLoadSuccessCount + getLoadExceptionCount == 0
.- Specified by:
getLoadExceptionRate
in interfaceCacheStatsMBean
-
estimateCurrentWeight
public long estimateCurrentWeight()
Description copied from interface:CacheStatsMBean
Total weight of the complete cache. Depending on implementation it might be the amount of RAM taken by the cache- Specified by:
estimateCurrentWeight
in interfaceCacheStatsMBean
- Returns:
- to weight of the cache
-
getRequestRateHistory
public CompositeData getRequestRateHistory()
- Specified by:
getRequestRateHistory
in interfacePersistentCacheStatsMBean
-
getHitRateHistory
public CompositeData getHitRateHistory()
- Specified by:
getHitRateHistory
in interfacePersistentCacheStatsMBean
-
getLoadRateHistory
public CompositeData getLoadRateHistory()
- Specified by:
getLoadRateHistory
in interfacePersistentCacheStatsMBean
-
getLoadExceptionRateHistory
public CompositeData getLoadExceptionRateHistory()
- Specified by:
getLoadExceptionRateHistory
in interfacePersistentCacheStatsMBean
-
getHitPercentageHistory
public CompositeData getHitPercentageHistory()
- Specified by:
getHitPercentageHistory
in interfacePersistentCacheStatsMBean
-
getPutRateHistory
public CompositeData getPutRateHistory()
- Specified by:
getPutRateHistory
in interfacePersistentCacheStatsMBean
-
getPutRejectedAlreadyPersistedRateHistory
public CompositeData getPutRejectedAlreadyPersistedRateHistory()
- Specified by:
getPutRejectedAlreadyPersistedRateHistory
in interfacePersistentCacheStatsMBean
-
getPutRejectedEntryNotUsedRateHistory
public CompositeData getPutRejectedEntryNotUsedRateHistory()
- Specified by:
getPutRejectedEntryNotUsedRateHistory
in interfacePersistentCacheStatsMBean
-
getPutRejectedQueueFullRateHistory
public CompositeData getPutRejectedQueueFullRateHistory()
- Specified by:
getPutRejectedQueueFullRateHistory
in interfacePersistentCacheStatsMBean
-
getPutRejectedAsCachedInSecRateHistory
public CompositeData getPutRejectedAsCachedInSecRateHistory()
- Specified by:
getPutRejectedAsCachedInSecRateHistory
in interfacePersistentCacheStatsMBean
-
getInvalidateOneRateHistory
public CompositeData getInvalidateOneRateHistory()
- Specified by:
getInvalidateOneRateHistory
in interfacePersistentCacheStatsMBean
-
getInvalidateAllRateHistory
public CompositeData getInvalidateAllRateHistory()
- Specified by:
getInvalidateAllRateHistory
in interfacePersistentCacheStatsMBean
-
getBroadcastRecvRateHistory
public CompositeData getBroadcastRecvRateHistory()
- Specified by:
getBroadcastRecvRateHistory
in interfacePersistentCacheStatsMBean
-
getUsedSpaceHistory
public CompositeData getUsedSpaceHistory()
- Specified by:
getUsedSpaceHistory
in interfacePersistentCacheStatsMBean
-
cacheInfoAsString
public String cacheInfoAsString()
Description copied from interface:CacheStatsMBean
Gathers the stats of the cache for logging.- Specified by:
cacheInfoAsString
in interfaceCacheStatsMBean
- Specified by:
cacheInfoAsString
in interfacePersistentCacheStatsMBean
-
getTotalLoadTime
public long getTotalLoadTime()
Description copied from interface:CacheStatsMBean
Returns the total number of nanoseconds the cache has spent loading new values. This can be used to calculate the miss penalty. This value is increased every timegetLoadSuccessCount
orgetLoadExceptionCount
is incremented.- Specified by:
getTotalLoadTime
in interfaceCacheStatsMBean
-
getAverageLoadPenalty
public double getAverageLoadPenalty()
Description copied from interface:CacheStatsMBean
Returns the average time spent loading new values. This is defined asgetTotalLoadTime / (getLoadSuccessCount + getLoadExceptionCount)
.- Specified by:
getAverageLoadPenalty
in interfaceCacheStatsMBean
-
getEvictionCount
public long getEvictionCount()
Description copied from interface:CacheStatsMBean
Returns the number of times an entry has been evicted. This count does not include manualorg.apache.jackrabbit.guava.common.cache.Cache#invalidate invalidations
.- Specified by:
getEvictionCount
in interfaceCacheStatsMBean
-
getElementCount
public long getElementCount()
Description copied from interface:CacheStatsMBean
Get the number of elements/objects in the cache.- Specified by:
getElementCount
in interfaceCacheStatsMBean
- Returns:
- the number of elements
-
getMaxTotalWeight
public long getMaxTotalWeight()
Description copied from interface:CacheStatsMBean
The maximum weight of entries the cache may contain.- Specified by:
getMaxTotalWeight
in interfaceCacheStatsMBean
- Returns:
- the maximum total weight of entries the cache may contain
-
resetStats
public void resetStats()
Description copied from interface:CacheStatsMBean
Reset the cache stats- Specified by:
resetStats
in interfaceCacheStatsMBean
-
-