Package com.tangosol.net.partition
Class PartitionStatistics
- java.lang.Object
-
- com.tangosol.net.partition.PartitionStatistics
-
- All Implemented Interfaces:
ExternalizableLite,Serializable
public class PartitionStatistics extends Object implements ExternalizableLite
PartitionStatistics encapsulates the statistics gathered for a given partition in a PartitionedService. Partition statistics are collected and managed by aDistributionManagerand can be used by aPartitionAssignmentStrategyto drive decisions about partition distribution.- Since:
- Coherence 12.2.1
- Author:
- rhl 2011.08.14
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected longm_cbStorageDirectThe portion of the partition size that is obtained directly frompartitionedmaps (in bytes).protected AtomicLongm_cbStorageIndirectThe portion of the partition size that cannot be obtained directly and has to be adjusted upon each cache entry update (in bytes).protected longm_cExecutionTimeThe total amount of time (in ms) that tasks/requests were executing.protected longm_cRequestsThe number of requests on this partition during the sampling period.protected longm_cSampleMillisThe sample duration (in ms).protected longm_cWaitTimeThe total amount of time (in ms) that tasks/requests spent waiting.protected longm_ldtLastTransferThe time at this this partition was last transferred.protected longm_ldtSampleStartThe sample start time.protected intm_nPartitionThe partition ID.
-
Constructor Summary
Constructors Constructor Description PartitionStatistics()Default constructor.PartitionStatistics(int nPartition, long ldtArrived)Constructor for the specified partition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadjustIndirectStorageSize(long cbDelta)Adjust the non-PartitionAwareBackingMap storage size of the partition by the specified amount.PartitionStatisticscopyFrom(PartitionStatistics stats)Copy the statistics from the specified PartitionStatistics reference.StringgetDescription()Return a human-readable description of this statistics object.protected longgetDirectStorageSize()Return the partition size from partitioned maps.protected longgetIndirectStorageSize()Return the partition size from non-PartitionAwareBackingMaps.longgetLastTransferTime()Return the time (on the primary owner) at which the partition was last transferred or restored.intgetPartition()Return the id of the partition for which these statistics apply.longgetRequestCount()Return the number of requests/second issued for the partition.longgetSampleDuration()Return the duration (ms) over which data was collected for this sample.longgetSampleStartTime()Return the time (on the sampling member) at which this data collection for this sample started.longgetStorageSize()Return the total size (in bytes) of the storage associated with the partition.longgetTaskExecutionTime()Return the total amount of time (in ms) that tasks/requests for this partition spent executing.longgetTaskWaitTime()Return the total amount of time (in ms) that tasks/requests for this partition spent waiting before execution.voidreadExternal(DataInput in)Restore the contents of this object by loading the object's state from the passed DataInput object.voidrecordRequest(long cWaitMillis, long cExecMillis)Update the partition statistics to record the specified request.voidreset()Reset the partition statistics state.PartitionStatisticssetDirectStorageSize(long cb)Set the PartitionAwareBackingMaps storage size of the partition.StringtoString()voidwriteExternal(DataOutput out)Save the contents of this object by storing the object's state into the passed DataOutput object.
-
-
-
Field Detail
-
m_nPartition
protected int m_nPartition
The partition ID.
-
m_ldtLastTransfer
protected long m_ldtLastTransfer
The time at this this partition was last transferred.
-
m_ldtSampleStart
protected long m_ldtSampleStart
The sample start time.
-
m_cSampleMillis
protected long m_cSampleMillis
The sample duration (in ms).
-
m_cbStorageDirect
protected long m_cbStorageDirect
The portion of the partition size that is obtained directly frompartitionedmaps (in bytes). This value is only updated on the service thread and doesn't have to be atomic.
-
m_cbStorageIndirect
protected AtomicLong 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_cRequests
The number of requests on this partition during the sampling period.
-
m_cExecutionTime
protected long m_cExecutionTime
The total amount of time (in ms) that tasks/requests were executing.
-
m_cWaitTime
protected long m_cWaitTime
The total amount of time (in ms) that tasks/requests spent waiting.
-
-
Constructor Detail
-
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 Detail
-
copyFrom
public PartitionStatistics copyFrom(PartitionStatistics stats)
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
public PartitionStatistics setDirectStorageSize(long cb)
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
public void readExternal(DataInput in) throws IOException
Restore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternalin 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 occursNotActiveException- if the object is not in its initial state, and therefore cannot be deserialized into
-
writeExternal
public void writeExternal(DataOutput out) throws IOException
Save the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternalin interfaceExternalizableLite- Parameters:
out- the DataOutput stream to write the state of this object to- Throws:
IOException- if an I/O exception occurs
-
getDescription
public String getDescription()
Return a human-readable description of this statistics object.- Returns:
- a human-readable description of this statistics object
-
-