public class PartitionPerIndexStats extends Object implements PerIndexStats
The main trait of the implementation is the lack of concurrency support since partitioned indexes and their stats are updated from a single thread only.
EMPTY
Constructor and Description |
---|
PartitionPerIndexStats() |
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 long makeTimestamp()
PerIndexStats
Used for latency measurement, expressed in nanoseconds.
makeTimestamp
in interface PerIndexStats
public long getCreationTime()
PerIndexStats
The value is relative to midnight, January 1, 1970 UTC and expressed in milliseconds.
getCreationTime
in interface PerIndexStats
public 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 PerIndexStats
public void incrementQueryCount()
PerIndexStats
incrementQueryCount
in interface PerIndexStats
public 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 PerIndexStats
public long getTotalHitLatency()
PerIndexStats
getTotalHitLatency
in interface PerIndexStats
public 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 PerIndexStats
public long getInsertCount()
PerIndexStats
getInsertCount
in interface PerIndexStats
public long getTotalInsertLatency()
PerIndexStats
To compute the average latency divide the returned value by insert operation count
.
getTotalInsertLatency
in interface PerIndexStats
public long getUpdateCount()
PerIndexStats
getUpdateCount
in interface PerIndexStats
public long getTotalUpdateLatency()
PerIndexStats
To compute the average latency divide the returned value by update operation count
.
getTotalUpdateLatency
in interface PerIndexStats
public long getRemoveCount()
PerIndexStats
getRemoveCount
in interface PerIndexStats
public long getTotalRemoveLatency()
PerIndexStats
To compute the average latency divide the returned value by remove operation count
.
getTotalRemoveLatency
in interface PerIndexStats
public long getMemoryCost()
PerIndexStats
Currently, 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 PerIndexStats
public void onInsert(long timestamp, IndexOperationStats operationStats, Index.OperationSource operationSource)
PerIndexStats
onInsert
in interface PerIndexStats
timestamp
- 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)
PerIndexStats
onUpdate
in interface PerIndexStats
timestamp
- 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)
PerIndexStats
onRemove
in interface PerIndexStats
timestamp
- 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()
PerIndexStats
onClear
in interface PerIndexStats
Index.clear()
public void onIndexHit(long timestamp, long hitCardinality)
PerIndexStats
Following operations generate a hit:
onIndexHit
in interface PerIndexStats
timestamp
- the time at which the hit-producing operation was
started.hitCardinality
- the cardinality of the hit.PerIndexStats.makeTimestamp()
public void resetPerQueryStats()
PerIndexStats
resetPerQueryStats
in interface PerIndexStats
public MemoryAllocator wrapMemoryAllocator(MemoryAllocator memoryAllocator)
PerIndexStats
Used for the off-heap memory cost tracking.
wrapMemoryAllocator
in interface PerIndexStats
memoryAllocator
- the memory allocator to wrap.public IndexOperationStats createOperationStats()
PerIndexStats
createOperationStats
in interface PerIndexStats
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.