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 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

    Fields
    Modifier and Type
    Field
    Description
    protected long
    The portion of the partition size that is obtained directly from partitioned 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

    Constructors
    Constructor
    Description
    Default constructor.
    PartitionStatistics(int nPartition, long ldtArrived)
    Constructor for the specified partition.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adjust the non-PartitionAwareBackingMap storage size of the partition by the specified amount.
    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 the partition statistics state.
    Set the PartitionAwareBackingMaps storage size of the partition.
    void
    Save the contents of this object by storing the object's state into the passed DataOutput object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • 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 from partitioned 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 Details

    • PartitionStatistics

      public PartitionStatistics()
      Default constructor.
    • PartitionStatistics

      public PartitionStatistics(int nPartition, long ldtArrived)
      Constructor for the specified partition.
      Parameters:
      nPartition - the partition id
      ldtArrived - the time at which this partition was transferred in
  • Method Details

    • 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 waiting
      cExecMillis - 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 interface ExternalizableLite
      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

      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 interface ExternalizableLite
      Parameters:
      out - the DataOutput stream to write the state of this object to
      Throws:
      IOException - if an I/O exception occurs
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDescription

      public String getDescription()
      Return a human-readable description of this statistics object.
      Returns:
      a human-readable description of this statistics object