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 aDistributionManager
and can be used by aPartitionAssignmentStrategy
to 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 long
m_cbStorageDirect
The portion of the partition size that is obtained directly frompartitioned
maps (in bytes).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).protected long
m_cExecutionTime
The total amount of time (in ms) that tasks/requests were executing.protected long
m_cRequests
The number of requests on this partition during the sampling period.protected long
m_cSampleMillis
The sample duration (in ms).protected long
m_cWaitTime
The total amount of time (in ms) that tasks/requests spent waiting.protected long
m_ldtLastTransfer
The time at this this partition was last transferred.protected long
m_ldtSampleStart
The sample start time.protected int
m_nPartition
The 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 void
adjustIndirectStorageSize(long cbDelta)
Adjust the non-PartitionAwareBackingMap storage size of the partition by the specified amount.PartitionStatistics
copyFrom(PartitionStatistics stats)
Copy the statistics from the specified PartitionStatistics reference.String
getDescription()
Return a human-readable description of this statistics object.protected long
getDirectStorageSize()
Return the partition size from partitioned maps.protected long
getIndirectStorageSize()
Return the partition size from non-PartitionAwareBackingMaps.long
getLastTransferTime()
Return the time (on the primary owner) at which the partition was last transferred or restored.int
getPartition()
Return the id of the partition for which these statistics apply.long
getRequestCount()
Return the number of requests/second issued for the partition.long
getSampleDuration()
Return the duration (ms) over which data was collected for this sample.long
getSampleStartTime()
Return the time (on the sampling member) at which this data collection for this sample started.long
getStorageSize()
Return the total size (in bytes) of the storage associated with the partition.long
getTaskExecutionTime()
Return the total amount of time (in ms) that tasks/requests for this partition spent executing.long
getTaskWaitTime()
Return the total amount of time (in ms) that tasks/requests for this partition spent waiting before execution.void
readExternal(DataInput in)
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.PartitionStatistics
setDirectStorageSize(long cb)
Set the PartitionAwareBackingMaps storage size of the partition.String
toString()
void
writeExternal(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 frompartitioned
maps (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:
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 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:
writeExternal
in 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
-
-