public class GlobalPerIndexStats extends Object implements PerIndexStats
The main trait of the implementation is the concurrency support, which is required for global indexes because they are shared among partitions.
EMPTY| Constructor and Description |
|---|
GlobalPerIndexStats(boolean ordered,
boolean usesCachedQueryableEntries)
Constructs a new instance of global index stats.
|
| Modifier and Type | Method and Description |
|---|---|
IndexOperationStats |
createOperationStats()
Creates a new per-operation stats instance.
|
long |
getCreationTime()
Returns the creation time of the index.
|
long |
getHitCount()
Returns the total number of hits into the index.
|
long |
getInsertCount()
Returns the number of insert operations performed on the index.
|
long |
getMemoryCost()
Returns the memory cost of the index in bytes.
|
long |
getQueryCount()
Returns the total number of queries served by the index.
|
long |
getRemoveCount()
Returns the number of remove operations performed on the index.
|
long |
getTotalHitLatency()
Returns the total hit latency for the index.
|
long |
getTotalInsertLatency()
Returns the total latency (in nanoseconds) of insert operations performed
on the index.
|
double |
getTotalNormalizedHitCardinality()
Returns the total normalized cardinality of the hits served by the index.
|
long |
getTotalRemoveLatency()
Returns the total latency (in nanoseconds) of remove operations performed
on the index.
|
long |
getTotalUpdateLatency()
Returns the total latency (in nanoseconds) of update operations performed
on the index.
|
long |
getUpdateCount()
Returns the number of update operations performed on the index.
|
void |
incrementQueryCount()
Increments the query count for the index.
|
long |
makeTimestamp()
Returns a new timestamp.
|
void |
onClear()
Invoked by the associated index after the index was cleared.
|
void |
onIndexHit(long timestamp,
long hitCardinality)
Invoked by the associated index after every index hit.
|
void |
onInsert(long timestamp,
IndexOperationStats operationStats,
Index.OperationSource operationSource)
Invoked by the associated index after every insert operation.
|
void |
onRemove(long timestamp,
IndexOperationStats operationStats,
Index.OperationSource operationSource)
Invoked by the associated index after every remove operation.
|
void |
onUpdate(long timestamp,
IndexOperationStats operationStats,
Index.OperationSource operationSource)
Invoked by the associated index after every update operation.
|
void |
resetPerQueryStats()
Resets the per-query stats, if any, currently tracked by this internal
index stats instance.
|
MemoryAllocator |
wrapMemoryAllocator(MemoryAllocator memoryAllocator)
Wraps the given memory allocator.
|
public GlobalPerIndexStats(boolean ordered,
boolean usesCachedQueryableEntries)
ordered - true if the stats are being created
for an ordered index, false otherwise.
Affects the on-heap memory cost calculation.usesCachedQueryableEntries - true if the stats are being created
for an index for which queryable entries are
cached, false otherwise. Affects the
on-heap memory cost calculation.public long makeTimestamp()
PerIndexStatsUsed for latency measurement, expressed in nanoseconds.
makeTimestamp in interface PerIndexStatspublic long getCreationTime()
PerIndexStatsThe value is relative to midnight, January 1, 1970 UTC and expressed in milliseconds.
getCreationTime in interface PerIndexStatspublic long getQueryCount()
PerIndexStats
The returned value may be less than the one returned by PerIndexStats.getHitCount() since a single query may hit the same index more than once.
getQueryCount in interface PerIndexStatspublic void incrementQueryCount()
PerIndexStatsincrementQueryCount in interface PerIndexStatspublic long getHitCount()
PerIndexStats
The returned value may be greater than the one returned by PerIndexStats.getQueryCount() since a single query may hit the same index more than once.
getHitCount in interface PerIndexStatspublic long getTotalHitLatency()
PerIndexStatsgetTotalHitLatency in interface PerIndexStatspublic double getTotalNormalizedHitCardinality()
PerIndexStats
Normalized hit cardinality is calculated as hit_cardinality /
entry_count at the time of the hit. The returned value is a sum of all
individual normalized hit cardinalities.
getTotalNormalizedHitCardinality in interface PerIndexStatspublic long getInsertCount()
PerIndexStatsgetInsertCount in interface PerIndexStatspublic long getTotalInsertLatency()
PerIndexStats
To compute the average latency divide the returned value by insert operation count.
getTotalInsertLatency in interface PerIndexStatspublic long getUpdateCount()
PerIndexStatsgetUpdateCount in interface PerIndexStatspublic long getTotalUpdateLatency()
PerIndexStats
To compute the average latency divide the returned value by update operation count.
getTotalUpdateLatency in interface PerIndexStatspublic long getRemoveCount()
PerIndexStatsgetRemoveCount in interface PerIndexStatspublic long getTotalRemoveLatency()
PerIndexStats
To compute the average latency divide the returned value by remove operation count.
getTotalRemoveLatency in interface PerIndexStatspublic long getMemoryCost()
PerIndexStatsCurrently, for on-heap indexes (OBJECT and BINARY storages), the returned value is just a best-effort approximation and doesn't indicate a precise on-heap memory usage of the index.
getMemoryCost in interface PerIndexStatspublic void onInsert(long timestamp,
IndexOperationStats operationStats,
Index.OperationSource operationSource)
PerIndexStatsonInsert in interface PerIndexStatstimestamp - the time at which the insert operation was started.operationStats - the operation stats to track the stats.operationSource - the operation source.PerIndexStats.makeTimestamp(),
Index.putEntry(com.hazelcast.query.impl.QueryableEntry, java.lang.Object, com.hazelcast.query.impl.Index.OperationSource)public void onUpdate(long timestamp,
IndexOperationStats operationStats,
Index.OperationSource operationSource)
PerIndexStatsonUpdate in interface PerIndexStatstimestamp - the time at which the update operation was started.operationStats - the operation stats to track the stats.operationSource - the operation source.PerIndexStats.makeTimestamp(),
Index.putEntry(com.hazelcast.query.impl.QueryableEntry, java.lang.Object, com.hazelcast.query.impl.Index.OperationSource)public void onRemove(long timestamp,
IndexOperationStats operationStats,
Index.OperationSource operationSource)
PerIndexStatsonRemove in interface PerIndexStatstimestamp - the time at which the remove operation was started.operationStats - the operation stats to track the stats.operationSource - the operation source.PerIndexStats.makeTimestamp(),
Index.removeEntry(com.hazelcast.nio.serialization.Data, java.lang.Object, com.hazelcast.query.impl.Index.OperationSource)public void onClear()
PerIndexStatsonClear in interface PerIndexStatsIndex.clear()public void onIndexHit(long timestamp,
long hitCardinality)
PerIndexStatsFollowing operations generate a hit:
onIndexHit in interface PerIndexStatstimestamp - the time at which the hit-producing operation was
started.hitCardinality - the cardinality of the hit.PerIndexStats.makeTimestamp()public void resetPerQueryStats()
PerIndexStatsresetPerQueryStats in interface PerIndexStatspublic MemoryAllocator wrapMemoryAllocator(MemoryAllocator memoryAllocator)
PerIndexStatsUsed for the off-heap memory cost tracking.
wrapMemoryAllocator in interface PerIndexStatsmemoryAllocator - the memory allocator to wrap.public IndexOperationStats createOperationStats()
PerIndexStatscreateOperationStats in interface PerIndexStatsCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.