Package com.tangosol.net.partition
Class PartitionStatistics
java.lang.Object
com.tangosol.net.partition.PartitionStatistics
- All Implemented Interfaces:
ExternalizableLite
,Serializable
PartitionStatistics encapsulates the statistics gathered for a given partition
in a PartitionedService. Partition statistics are collected and managed by a
DistributionManager
and can be used by a PartitionAssignmentStrategy
to drive decisions about partition distribution.- Since:
- Coherence 12.2.1
- Author:
- rhl 2011.08.14
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
The portion of the partition size that is obtained directly frompartitioned
maps (in bytes).protected AtomicLong
The portion of the partition size that cannot be obtained directly and has to be adjusted upon each cache entry update (in bytes).protected long
The total amount of time (in ms) that tasks/requests were executing.protected long
The number of requests on this partition during the sampling period.protected long
The sample duration (in ms).protected long
The total amount of time (in ms) that tasks/requests spent waiting.protected long
The time at this this partition was last transferred.protected long
The sample start time.protected int
The partition ID. -
Constructor Summary
ConstructorDescriptionDefault constructor.PartitionStatistics
(int nPartition, long ldtArrived) Constructor for the specified partition. -
Method Summary
Modifier and TypeMethodDescriptionvoid
adjustIndirectStorageSize
(long cbDelta) Adjust the non-PartitionAwareBackingMap storage size of the partition by the specified amount.copyFrom
(PartitionStatistics stats) Copy the statistics from the specified PartitionStatistics reference.Return a human-readable description of this statistics object.protected long
Return the partition size from partitioned maps.protected long
Return the partition size from non-PartitionAwareBackingMaps.long
Return the time (on the primary owner) at which the partition was last transferred or restored.int
Return the id of the partition for which these statistics apply.long
Return the number of requests/second issued for the partition.long
Return the duration (ms) over which data was collected for this sample.long
Return the time (on the sampling member) at which this data collection for this sample started.long
Return the total size (in bytes) of the storage associated with the partition.long
Return the total amount of time (in ms) that tasks/requests for this partition spent executing.long
Return the total amount of time (in ms) that tasks/requests for this partition spent waiting before execution.void
Restore the contents of this object by loading the object's state from the passed DataInput object.void
recordRequest
(long cWaitMillis, long cExecMillis) Update the partition statistics to record the specified request.void
reset()
Reset the partition statistics state.setDirectStorageSize
(long cb) Set the PartitionAwareBackingMaps storage size of the partition.toString()
void
writeExternal
(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.
-
Field Details
-
m_nPartition
protected int m_nPartitionThe partition ID. -
m_ldtLastTransfer
protected long m_ldtLastTransferThe time at this this partition was last transferred. -
m_ldtSampleStart
protected long m_ldtSampleStartThe sample start time. -
m_cSampleMillis
protected long m_cSampleMillisThe sample duration (in ms). -
m_cbStorageDirect
protected long m_cbStorageDirectThe portion of the partition size that is obtained directly frompartitioned
maps (in bytes). This value is only updated on the service thread and doesn't have to be atomic. -
m_cbStorageIndirect
The portion of the partition size that cannot be obtained directly and has to be adjusted upon each cache entry update (in bytes). -
m_cRequests
protected long m_cRequestsThe number of requests on this partition during the sampling period. -
m_cExecutionTime
protected long m_cExecutionTimeThe total amount of time (in ms) that tasks/requests were executing. -
m_cWaitTime
protected long m_cWaitTimeThe total amount of time (in ms) that tasks/requests spent waiting.
-
-
Constructor Details
-
PartitionStatistics
public PartitionStatistics()Default constructor. -
PartitionStatistics
public PartitionStatistics(int nPartition, long ldtArrived) Constructor for the specified partition.- Parameters:
nPartition
- the partition idldtArrived
- the time at which this partition was transferred in
-
-
Method Details
-
copyFrom
Copy the statistics from the specified PartitionStatistics reference.- Parameters:
stats
- the statistics to copy from- Returns:
- the copied statistics
-
recordRequest
public void recordRequest(long cWaitMillis, long cExecMillis) Update the partition statistics to record the specified request.- Parameters:
cWaitMillis
- the time (in ms) that the task/request spent waitingcExecMillis
- the time (in ms) that the task/request spent executing
-
adjustIndirectStorageSize
public void adjustIndirectStorageSize(long cbDelta) Adjust the non-PartitionAwareBackingMap storage size of the partition by the specified amount.- Parameters:
cbDelta
- the amount to adjust the size (could be negative)
-
setDirectStorageSize
Set the PartitionAwareBackingMaps storage size of the partition.Note that this method is called only on the service thread at the end of sampling period.
- Parameters:
cb
- total storage size of the PartitionAwareBackingMaps in the partition- Returns:
- the PartitionStatistics reference
-
reset
public void reset()Reset the partition statistics state. -
getPartition
public int getPartition()Return the id of the partition for which these statistics apply.- Returns:
- the partition id
-
getLastTransferTime
public long getLastTransferTime()Return the time (on the primary owner) at which the partition was last transferred or restored.- Returns:
- the time at which the specified storage was last transferred
-
getTaskExecutionTime
public long getTaskExecutionTime()Return the total amount of time (in ms) that tasks/requests for this partition spent executing.- Returns:
- the total amount of time that tasks spent waiting
-
getTaskWaitTime
public long getTaskWaitTime()Return the total amount of time (in ms) that tasks/requests for this partition spent waiting before execution.- Returns:
- the total amount of time that tasks spent waiting
-
getRequestCount
public long getRequestCount()Return the number of requests/second issued for the partition.- Returns:
- the request count/second
-
getDirectStorageSize
protected long getDirectStorageSize()Return the partition size from partitioned maps.- Returns:
- the partition size from partitioned maps
-
getIndirectStorageSize
protected long getIndirectStorageSize()Return the partition size from non-PartitionAwareBackingMaps.- Returns:
- the partition size from non-PartitionAwareBackingMaps
-
getStorageSize
public long getStorageSize()Return the total size (in bytes) of the storage associated with the partition.- Returns:
- the storage size
-
getSampleStartTime
public long getSampleStartTime()Return the time (on the sampling member) at which this data collection for this sample started.- Returns:
- the time that this sample started
-
getSampleDuration
public long getSampleDuration()Return the duration (ms) over which data was collected for this sample.- Returns:
- the sample duration
-
readExternal
Restore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternal
in interfaceExternalizableLite
- Parameters:
in
- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException
- if an I/O exception occurs
-
writeExternal
Save the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternal
in interfaceExternalizableLite
- Parameters:
out
- the DataOutput stream to write the state of this object to- Throws:
IOException
- if an I/O exception occurs
-
toString
-
getDescription
Return a human-readable description of this statistics object.- Returns:
- a human-readable description of this statistics object
-