com.continuent.tungsten.replicator.conf
Class ReplicatorMonitor

java.lang.Object
  extended by com.continuent.tungsten.replicator.conf.ReplicatorMonitor
All Implemented Interfaces:
ReplicatorMonitorMBean

public class ReplicatorMonitor
extends java.lang.Object
implements ReplicatorMonitorMBean

This class implements JMX monitoring statistics for the replicator.

Version:
1.0
Author:
Robert Hodges

Field Summary
static int COUNT_COUNT
           
static int COUNT_EVENTS_PER_COMMIT
           
static int COUNT_EVENTS_PER_MESSAGE
           
static int COUNT_RECORDS_PER_EVENT
           
static java.lang.String[] countNames
           
static int CPU_APPLIERAEVENT
           
static int CPU_APPLIERBISQL
           
static int CPU_APPLIERBUSQL
           
static int CPU_APPLIEREXSQL
           
static int CPU_APPLIERGEVENT
           
static int CPU_APPLIERMEVENT
           
static int CPU_APPLIERPRSQL
           
static int CPU_APPLIERSTRANS
           
static int CPU_CHECKSUM
           
static int CPU_COUNT
           
static int CPU_DB_DESERIAL
           
static int CPU_DB_SERIAL
           
static int CPU_EXTRACT
           
static int CPU_INSERTTHL
           
static int CPU_MSG_DESERIAL
           
static int CPU_MSG_SERIAL
           
static java.lang.String[] cpuNames
           
static int REAL_APPLY
           
static int REAL_COMMIT
           
static int REAL_COUNT
           
static int REAL_DELWAIT
           
static int REAL_EXTBODY
           
static int REAL_EXTHEAD
           
static int REAL_EXTRACT
           
static int REAL_INSWAIT
           
static int REAL_THLCLIWAIT
           
static int REAL_THLSRVWAIT
           
static int REAL_UPDWAIT
           
static int REAL_WAIT4EXT
           
static int REAL_WAIT4THLCLI
           
static java.lang.String[] realNames
           
 
Method Summary
 void clearCounters()
          Clear monitoring counters and timing intervals.
 DynamicMBeanHelper createHelper()
          
 void decreaseUsedCacheSize()
           
 long getApplied()
          Returns the number of transactions applied to target.
 long getAppliedLastSeqNo()
          Returns the last sequence number that was applied.
 java.sql.Timestamp getAppliedLastSourceTStamp()
          Returns the source timestamp of the last event that was applied.
 java.sql.Timestamp getAppliedLastTargetTStamp()
          Returns the timestamp when the last event was applied.
 double getAppliedLatency()
          Returns the latency of the last event processed in seconds, including heartbeat events.
 double getAppliedPerSec()
          Returns the average events applied per second.
 java.util.ArrayList<MonitorThreadInfo> getCPUTimes()
          Returns hash map of CPUTimes per thread
 boolean getDetailEnabled()
          return TRUE IFF detailed statistics are enabled
 long getEvents()
          Returns the number of events (extracted for extractor, applied for applier).
 int getEventsTotalCacheSize()
          Returns the events cache total size.
 int getEventsUsedCacheSize()
          Returns the events cache used size.
 long getExtracted()
          Returns the total events extracted.
 long getExtractedLastSeqNo()
          Returns the last sequence number that was extracted.
 double getExtractedPerSec()
          Returns the average events extracted per second.
static ReplicatorMonitor getInstance()
          Default method to use for normal operations
static ReplicatorMonitor getInstance(java.lang.String instanceId, boolean doClear)
          Singleton implementation
 long getLatestEpochNumber()
           
 java.lang.String getLatestEventId()
           
 double getMonitoringIntervalSecs()
          Gets the length of the current monitoring interval in seconds.
 long getReceived()
          Returns the number of events received and placed in the THL.
 long getReceivedLastSeqNo()
          Returns the sequence number of the last event received.
 java.sql.Timestamp getReceivedLastSourceTStamp()
          Returns the source timestamp of the last event that was received.
 java.sql.Timestamp getReceivedLastTargetTStamp()
          Returns the timestamp when the last event was received.
 double getReceivedLatency()
          Returns the latency of the last event received in seconds.
 double getReceivedPerSec()
          Returns the average events received per second.
 long getRows()
          Returns the number of rows (extracted for extrator, applied for applier).
 long getStartTimeMillis()
          Returns the monitoring start time in milliseconds.
 int getUsedCacheRatio()
          Returns used vs.
 void increaseUsedCacheSize()
           
 void incrementApplied()
          Increment the number of applied transactions.
 void incrementEvents(int numberOfRows)
           
 void incrementExtracted()
           
 void incrementReceived()
          Increment the number of received transactions.
 void recordEvent(int eventID)
           
 void recordEvent(int eventID, long count)
           
 void setAppliedLastSeqNo(long lastSeqNoApplied)
           
 void setAppliedLastSourceTStamp(java.sql.Timestamp appliedLastSourceTStamp)
           
 void setAppliedLastTargetTStamp(java.sql.Timestamp appliedLastTargetTStamp)
           
 void setCacheSize(int size)
           
 void setDetailEnabled(boolean detailEnabled)
          set value for detail statistics gathering
 void setExtractedLastSeqNo(long lastSeqNoExtracted)
           
 void setLatestEpochNumber(long epochNumber)
           
 void setLatestEventId(java.lang.String eventId)
           
 void setReceivedLastSeqNo(long lastSeqNoReceived)
           
 void setReceivedLastSourceTStamp(java.sql.Timestamp receivedLastSourceTStamp)
           
 void setReceivedLastTargetTStamp(java.sql.Timestamp receivedLastTargetTStamp)
           
 long startCPUEvent(int eventID)
           
 long startRealEvent(int eventID)
           
 void stopCPUEvent(int eventID, long startingToken)
           
 void stopRealEvent(int eventID, long startingToken)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CPU_MSG_SERIAL

public static final int CPU_MSG_SERIAL
See Also:
Constant Field Values

CPU_MSG_DESERIAL

public static final int CPU_MSG_DESERIAL
See Also:
Constant Field Values

CPU_DB_SERIAL

public static final int CPU_DB_SERIAL
See Also:
Constant Field Values

CPU_DB_DESERIAL

public static final int CPU_DB_DESERIAL
See Also:
Constant Field Values

CPU_EXTRACT

public static final int CPU_EXTRACT
See Also:
Constant Field Values

CPU_INSERTTHL

public static final int CPU_INSERTTHL
See Also:
Constant Field Values

CPU_CHECKSUM

public static final int CPU_CHECKSUM
See Also:
Constant Field Values

CPU_APPLIERBUSQL

public static final int CPU_APPLIERBUSQL
See Also:
Constant Field Values

CPU_APPLIERPRSQL

public static final int CPU_APPLIERPRSQL
See Also:
Constant Field Values

CPU_APPLIERBISQL

public static final int CPU_APPLIERBISQL
See Also:
Constant Field Values

CPU_APPLIEREXSQL

public static final int CPU_APPLIEREXSQL
See Also:
Constant Field Values

CPU_APPLIERGEVENT

public static final int CPU_APPLIERGEVENT
See Also:
Constant Field Values

CPU_APPLIERAEVENT

public static final int CPU_APPLIERAEVENT
See Also:
Constant Field Values

CPU_APPLIERMEVENT

public static final int CPU_APPLIERMEVENT
See Also:
Constant Field Values

CPU_APPLIERSTRANS

public static final int CPU_APPLIERSTRANS
See Also:
Constant Field Values

CPU_COUNT

public static final int CPU_COUNT
See Also:
Constant Field Values

cpuNames

public static final java.lang.String[] cpuNames

REAL_THLSRVWAIT

public static final int REAL_THLSRVWAIT
See Also:
Constant Field Values

REAL_THLCLIWAIT

public static final int REAL_THLCLIWAIT
See Also:
Constant Field Values

REAL_WAIT4EXT

public static final int REAL_WAIT4EXT
See Also:
Constant Field Values

REAL_WAIT4THLCLI

public static final int REAL_WAIT4THLCLI
See Also:
Constant Field Values

REAL_EXTHEAD

public static final int REAL_EXTHEAD
See Also:
Constant Field Values

REAL_EXTBODY

public static final int REAL_EXTBODY
See Also:
Constant Field Values

REAL_INSWAIT

public static final int REAL_INSWAIT
See Also:
Constant Field Values

REAL_UPDWAIT

public static final int REAL_UPDWAIT
See Also:
Constant Field Values

REAL_DELWAIT

public static final int REAL_DELWAIT
See Also:
Constant Field Values

REAL_COMMIT

public static final int REAL_COMMIT
See Also:
Constant Field Values

REAL_APPLY

public static final int REAL_APPLY
See Also:
Constant Field Values

REAL_EXTRACT

public static final int REAL_EXTRACT
See Also:
Constant Field Values

REAL_COUNT

public static final int REAL_COUNT
See Also:
Constant Field Values

realNames

public static final java.lang.String[] realNames

COUNT_RECORDS_PER_EVENT

public static final int COUNT_RECORDS_PER_EVENT
See Also:
Constant Field Values

COUNT_EVENTS_PER_MESSAGE

public static final int COUNT_EVENTS_PER_MESSAGE
See Also:
Constant Field Values

COUNT_EVENTS_PER_COMMIT

public static final int COUNT_EVENTS_PER_COMMIT
See Also:
Constant Field Values

COUNT_COUNT

public static final int COUNT_COUNT
See Also:
Constant Field Values

countNames

public static final java.lang.String[] countNames
Method Detail

getInstance

public static ReplicatorMonitor getInstance(java.lang.String instanceId,
                                            boolean doClear)
Singleton implementation

Returns:
singleton ReplicatorMonitor

getInstance

public static ReplicatorMonitor getInstance()
Default method to use for normal operations

Returns:
'primary' instance of the monitor.

getDetailEnabled

public boolean getDetailEnabled()
Description copied from interface: ReplicatorMonitorMBean
return TRUE IFF detailed statistics are enabled

Specified by:
getDetailEnabled in interface ReplicatorMonitorMBean

setDetailEnabled

public void setDetailEnabled(boolean detailEnabled)
Description copied from interface: ReplicatorMonitorMBean
set value for detail statistics gathering

Specified by:
setDetailEnabled in interface ReplicatorMonitorMBean

incrementEvents

public void incrementEvents(int numberOfRows)

getEvents

public long getEvents()
Description copied from interface: ReplicatorMonitorMBean
Returns the number of events (extracted for extractor, applied for applier).

Specified by:
getEvents in interface ReplicatorMonitorMBean

getRows

public long getRows()
Description copied from interface: ReplicatorMonitorMBean
Returns the number of rows (extracted for extrator, applied for applier).

Specified by:
getRows in interface ReplicatorMonitorMBean

recordEvent

public void recordEvent(int eventID)

recordEvent

public void recordEvent(int eventID,
                        long count)

startCPUEvent

public long startCPUEvent(int eventID)

stopCPUEvent

public void stopCPUEvent(int eventID,
                         long startingToken)

startRealEvent

public long startRealEvent(int eventID)

stopRealEvent

public void stopRealEvent(int eventID,
                          long startingToken)

incrementApplied

public void incrementApplied()
Increment the number of applied transactions.


setAppliedLastTargetTStamp

public void setAppliedLastTargetTStamp(java.sql.Timestamp appliedLastTargetTStamp)

setAppliedLastSourceTStamp

public void setAppliedLastSourceTStamp(java.sql.Timestamp appliedLastSourceTStamp)

setAppliedLastSeqNo

public void setAppliedLastSeqNo(long lastSeqNoApplied)

incrementExtracted

public void incrementExtracted()

setExtractedLastSeqNo

public void setExtractedLastSeqNo(long lastSeqNoExtracted)

incrementReceived

public void incrementReceived()
Increment the number of received transactions.


setReceivedLastSeqNo

public void setReceivedLastSeqNo(long lastSeqNoReceived)

setReceivedLastTargetTStamp

public void setReceivedLastTargetTStamp(java.sql.Timestamp receivedLastTargetTStamp)

setReceivedLastSourceTStamp

public void setReceivedLastSourceTStamp(java.sql.Timestamp receivedLastSourceTStamp)

clearCounters

public void clearCounters()
Description copied from interface: ReplicatorMonitorMBean
Clear monitoring counters and timing intervals. This ensures that values are current when looking at transaction processing rates.

Specified by:
clearCounters in interface ReplicatorMonitorMBean

getStartTimeMillis

public long getStartTimeMillis()
Description copied from interface: ReplicatorMonitorMBean
Returns the monitoring start time in milliseconds.

Specified by:
getStartTimeMillis in interface ReplicatorMonitorMBean

getMonitoringIntervalSecs

public double getMonitoringIntervalSecs()
Description copied from interface: ReplicatorMonitorMBean
Gets the length of the current monitoring interval in seconds.

Specified by:
getMonitoringIntervalSecs in interface ReplicatorMonitorMBean

getApplied

public long getApplied()
Description copied from interface: ReplicatorMonitorMBean
Returns the number of transactions applied to target.

Specified by:
getApplied in interface ReplicatorMonitorMBean

getAppliedLatency

public double getAppliedLatency()
Description copied from interface: ReplicatorMonitorMBean
Returns the latency of the last event processed in seconds, including heartbeat events.

Specified by:
getAppliedLatency in interface ReplicatorMonitorMBean

getAppliedPerSec

public double getAppliedPerSec()
Description copied from interface: ReplicatorMonitorMBean
Returns the average events applied per second.

Specified by:
getAppliedPerSec in interface ReplicatorMonitorMBean

getAppliedLastTargetTStamp

public java.sql.Timestamp getAppliedLastTargetTStamp()
Description copied from interface: ReplicatorMonitorMBean
Returns the timestamp when the last event was applied.

Specified by:
getAppliedLastTargetTStamp in interface ReplicatorMonitorMBean

getAppliedLastSourceTStamp

public java.sql.Timestamp getAppliedLastSourceTStamp()
Description copied from interface: ReplicatorMonitorMBean
Returns the source timestamp of the last event that was applied.

Specified by:
getAppliedLastSourceTStamp in interface ReplicatorMonitorMBean

getAppliedLastSeqNo

public long getAppliedLastSeqNo()
Description copied from interface: ReplicatorMonitorMBean
Returns the last sequence number that was applied.

Specified by:
getAppliedLastSeqNo in interface ReplicatorMonitorMBean

getExtracted

public long getExtracted()
Description copied from interface: ReplicatorMonitorMBean
Returns the total events extracted.

Specified by:
getExtracted in interface ReplicatorMonitorMBean

getExtractedLastSeqNo

public long getExtractedLastSeqNo()
Description copied from interface: ReplicatorMonitorMBean
Returns the last sequence number that was extracted.

Specified by:
getExtractedLastSeqNo in interface ReplicatorMonitorMBean

getExtractedPerSec

public double getExtractedPerSec()
Description copied from interface: ReplicatorMonitorMBean
Returns the average events extracted per second.

Specified by:
getExtractedPerSec in interface ReplicatorMonitorMBean

getReceived

public long getReceived()
Description copied from interface: ReplicatorMonitorMBean
Returns the number of events received and placed in the THL.

Specified by:
getReceived in interface ReplicatorMonitorMBean

getReceivedLastSeqNo

public long getReceivedLastSeqNo()
Description copied from interface: ReplicatorMonitorMBean
Returns the sequence number of the last event received.

Specified by:
getReceivedLastSeqNo in interface ReplicatorMonitorMBean

getReceivedLatency

public double getReceivedLatency()
Description copied from interface: ReplicatorMonitorMBean
Returns the latency of the last event received in seconds.

Specified by:
getReceivedLatency in interface ReplicatorMonitorMBean

getReceivedPerSec

public double getReceivedPerSec()
Description copied from interface: ReplicatorMonitorMBean
Returns the average events received per second.

Specified by:
getReceivedPerSec in interface ReplicatorMonitorMBean

getReceivedLastTargetTStamp

public java.sql.Timestamp getReceivedLastTargetTStamp()
Description copied from interface: ReplicatorMonitorMBean
Returns the timestamp when the last event was received.

Specified by:
getReceivedLastTargetTStamp in interface ReplicatorMonitorMBean

getReceivedLastSourceTStamp

public java.sql.Timestamp getReceivedLastSourceTStamp()
Description copied from interface: ReplicatorMonitorMBean
Returns the source timestamp of the last event that was received.

Specified by:
getReceivedLastSourceTStamp in interface ReplicatorMonitorMBean

setCacheSize

public void setCacheSize(int size)

increaseUsedCacheSize

public void increaseUsedCacheSize()

decreaseUsedCacheSize

public void decreaseUsedCacheSize()

getEventsTotalCacheSize

public int getEventsTotalCacheSize()
Description copied from interface: ReplicatorMonitorMBean
Returns the events cache total size.

Specified by:
getEventsTotalCacheSize in interface ReplicatorMonitorMBean

getEventsUsedCacheSize

public int getEventsUsedCacheSize()
Description copied from interface: ReplicatorMonitorMBean
Returns the events cache used size.

Specified by:
getEventsUsedCacheSize in interface ReplicatorMonitorMBean

getUsedCacheRatio

public int getUsedCacheRatio()
Description copied from interface: ReplicatorMonitorMBean
Returns used vs. total cache size ratio

Specified by:
getUsedCacheRatio in interface ReplicatorMonitorMBean

getCPUTimes

public java.util.ArrayList<MonitorThreadInfo> getCPUTimes()
Description copied from interface: ReplicatorMonitorMBean
Returns hash map of CPUTimes per thread

Specified by:
getCPUTimes in interface ReplicatorMonitorMBean

getLatestEpochNumber

public long getLatestEpochNumber()
Specified by:
getLatestEpochNumber in interface ReplicatorMonitorMBean
Returns:
the latest epoch number, the context of which is determined by whether the replicator's role is master or slave.

setLatestEpochNumber

public void setLatestEpochNumber(long epochNumber)

getLatestEventId

public java.lang.String getLatestEventId()
Specified by:
getLatestEventId in interface ReplicatorMonitorMBean
Returns:
the latest event id, the context of which is determined by whether the replicator's role is master or slave.

setLatestEventId

public void setLatestEventId(java.lang.String eventId)

createHelper

public DynamicMBeanHelper createHelper()
                                throws java.lang.Exception

Specified by:
createHelper in interface ReplicatorMonitorMBean
Throws:
java.lang.Exception
See Also:
ReplicatorMonitorMBean.createHelper()