com.neeve.sma
Class MessageLatencyManager

java.lang.Object
  extended by com.neeve.sma.MessageLatencyManager

public final class MessageLatencyManager
extends Object

Stores cross-stack message latencies.


Nested Class Summary
static class MessageLatencyManager.MessagingDirection
          Used with update(com.neeve.sma.MessageView, com.neeve.sma.MessageLatencyManager.MessagingDirection) to indicate whether to update inbound or outbound related latencies
static interface MessageLatencyManager.UpdateListener
          Provides a listener callback that allows application to hook a listener that is called once message latency stats have been updated for a MessageView.
 
Field Summary
static boolean captureMsgLatencyStats
          Contains whether messaging related latencies should be captured
static String PROP_MESSAGE_LATENCY_STATS
          Property that enabled message latency stats tracking.
static boolean PROP_MESSAGE_LATENCY_STATS_DEFAULT
          The default value for enabling "nv.msg.latency.stats" (false)
static String PROP_MESSAGE_LATENCY_STATS_INTERVAL
          When set to a value greater than 0 in seconds message latency stats are traced at the provided interval.
static String PROP_MESSAGE_LATENCY_STATS_INTERVAL_DEFAULT
          The default value for "nv.msg.latency.stats.interval" ("0" seconds)
static String PROP_MESSAGETYPE_LATENCY_STATS
          Property that enabled per message type latency stats tracking.
static boolean PROP_MESSAGETYPE_LATENCY_STATS_DEFAULT
          The default value for enabling "nv.msg.latency.stats" (false)
 
Constructor Summary
MessageLatencyManager(MessageBusBinding binding, String name)
          Construct using the manager name
 
Method Summary
 MessageLatencyManager compute()
          Compute derived stats from the current sample set.
 StringBuilder get(StringBuilder sb, boolean csv)
          Format and stats into a string builder object
 IStats.Latencies getCreateToSendLatencies()
          The create to send latencies in microsends.
 IStats.Latencies getDeserializeLatencies()
          Get the d (deserialize) latencies in microseconds.
 IStats.Latencies getDeserializeToReceiveLatencies()
          Get the d2i (post-deserialize->receive) latencies in microseconds.
 IStats.Latencies getOriginToReceiveLatencies()
          Get the o2i (origin->receive) latencies in microseconds The time in microseconds.from when the message was originally created to just after it was received.
 IStats.Latencies getSendToPollLatencies()
          The send to poll latencies in microseconds.
 IStats.Latencies getSendToSerializeLatencies()
          The send to serialize latencies in microsends.
 IStats.Latencies getSerializeLatencies()
          Get the serialize latencies in microseconds.
 IStats.Latencies getSerializeToWireLatencies()
          Get the s2w (post-serialize->pre-wire) latencies in microseconds.
 IStats.Latencies getWireLatencies()
          Get the w (wire) latencies in microseconds.
 IStats.Latencies getWireSendLatencies()
          Get the outbound 'ws' (wire send) latencies in microseconds.
 IStats.Latencies getWireToDeserializeLatencies()
          Get the w2d (wire->pre-deserialize) latencies in microseconds.
 IStats.Latencies getWireToWireLatencies()
          Get the w2w (wire->wire) latencies, for outbound messages the time from inbound message receipt off the wire to after the outbound message was written to the wire.
 String name()
          Get the latency manager's name (must be unique system wide)
 void reset()
          Reset the latency manager
 void setUpdateListener(MessageLatencyManager.UpdateListener listener)
          Sets an MessageLatencyManager.UpdateListener for this latency manager.
 void shutdown()
          Shut down the latency stats manager
 void start()
          Starts dump of message latency stats (if stats interval is set)
 void update(MessageView view, MessageLatencyManager.MessagingDirection direction)
          Update message latencies
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_MESSAGE_LATENCY_STATS

public static final String PROP_MESSAGE_LATENCY_STATS
Property that enabled message latency stats tracking.

When set to true timings for messages are captured as they flow through the system. Enabling this property can increase latency due to the overhead of tracking timestamps.

Property Name: "nv.msg.latency.stats"
Default Value: false

See Also:
Constant Field Values

PROP_MESSAGE_LATENCY_STATS_DEFAULT

public static final boolean PROP_MESSAGE_LATENCY_STATS_DEFAULT
The default value for enabling "nv.msg.latency.stats" (false)

See Also:
Constant Field Values

PROP_MESSAGE_LATENCY_STATS_INTERVAL

public static final String PROP_MESSAGE_LATENCY_STATS_INTERVAL
When set to a value greater than 0 in seconds message latency stats are traced at the provided interval.

This setting has no effect if "nv.msg.latency.stats" is false

Property Name: "nv.msg.latency.stats.interval"
Default Value: "0"

See Also:
PROP_MESSAGE_LATENCY_STATS, Constant Field Values

PROP_MESSAGE_LATENCY_STATS_INTERVAL_DEFAULT

public static final String PROP_MESSAGE_LATENCY_STATS_INTERVAL_DEFAULT
The default value for "nv.msg.latency.stats.interval" ("0" seconds)

See Also:
Constant Field Values

PROP_MESSAGETYPE_LATENCY_STATS

public static final String PROP_MESSAGETYPE_LATENCY_STATS
Property that enabled per message type latency stats tracking.

When set to true timings for each message type are individual tracked as separate stats. This can be useful in tracking down issues in which a particular message type is problematic (for example tracking down a high application handler message processing time).

Property Name: "nv.msgtype.latency.stats"
Default Value: false

See Also:
Constant Field Values

PROP_MESSAGETYPE_LATENCY_STATS_DEFAULT

public static final boolean PROP_MESSAGETYPE_LATENCY_STATS_DEFAULT
The default value for enabling "nv.msg.latency.stats" (false)

See Also:
Constant Field Values

captureMsgLatencyStats

public static final boolean captureMsgLatencyStats
Contains whether messaging related latencies should be captured

Constructor Detail

MessageLatencyManager

public MessageLatencyManager(MessageBusBinding binding,
                             String name)
Construct using the manager name

Method Detail

name

public final String name()
Get the latency manager's name (must be unique system wide)


start

public final void start()
Starts dump of message latency stats (if stats interval is set)


setUpdateListener

public final void setUpdateListener(MessageLatencyManager.UpdateListener listener)
Sets an MessageLatencyManager.UpdateListener for this latency manager.

The MessageLatencyManager.UpdateListener update listener is called each time the latencies are updated for a message. This should only be called once per message during normal application flow, but in the event of redeliveries it is possible that the update listener may be invoked more than once for a given MessageView.


update

public final void update(MessageView view,
                         MessageLatencyManager.MessagingDirection direction)
Update message latencies


compute

public final MessageLatencyManager compute()
Compute derived stats from the current sample set.


get

public final StringBuilder get(StringBuilder sb,
                               boolean csv)
Format and stats into a string builder object

Returns:
Returns the passed in string builder object.

getCreateToSendLatencies

public final IStats.Latencies getCreateToSendLatencies()
The create to send latencies in microsends.

The time from when the message was created until it was 'offered' to the bus binding for send.

A high value in this statistic may indicate that there may be some bottleneck or overhead prior to the message being sent or could be indicative of significant time spent populating the message.


getSendToPollLatencies

public final IStats.Latencies getSendToPollLatencies()
The send to poll latencies in microseconds.

The time from when the message was offered for send until the binding picks up the message for send. This statistic is useful for a binding offer in a detached mode and captures time the message is queued before delivery is started, when a binding is not operating in a detached mode this statistic is expected to be 0.

A high o2p may indicate that the bus binding is backed up by flow control or that the thread sending messages is cpu bound.


getSendToSerializeLatencies

public final IStats.Latencies getSendToSerializeLatencies()
The send to serialize latencies in microsends.

The time spent from the point at which the binding begins the send of the message until just before the binding is serialized into the underlying transport. A high value here indicates that there are delays in the bus binding code path prior to serialization.


getSerializeLatencies

public final IStats.Latencies getSerializeLatencies()
Get the serialize latencies in microseconds.

The serialize latencies in microsends, the spent serializing the MessageView to its transport encoding (aka: 's')

A high value here may indicate encoding innefficiences or large message payloads.


getSerializeToWireLatencies

public final IStats.Latencies getSerializeToWireLatencies()
Get the s2w (post-serialize->pre-wire) latencies in microseconds.

A high value here often indicates that the message is network bound (flow controlled).


getWireSendLatencies

public final IStats.Latencies getWireSendLatencies()
Get the outbound 'ws' (wire send) latencies in microseconds.

The time spent by the message bus provider writing the message to the wire. This time covers an time spent blocked in the provider due to flow control and time in the provider implementation's send api.


getWireLatencies

public final IStats.Latencies getWireLatencies()
Get the w (wire) latencies in microseconds.

The time spent on the wire from when the message was written to the transport by the sender to the time it was received by the receiver.


getWireToDeserializeLatencies

public final IStats.Latencies getWireToDeserializeLatencies()
Get the w2d (wire->pre-deserialize) latencies in microseconds.

The time from when the serialized form was received from the transport to deserialization.


getDeserializeLatencies

public final IStats.Latencies getDeserializeLatencies()
Get the d (deserialize) latencies in microseconds.

The time (in microseconds) spent deserializing the message and wrapping it in a MessageView.


getDeserializeToReceiveLatencies

public final IStats.Latencies getDeserializeToReceiveLatencies()
Get the d2i (post-deserialize->receive) latencies in microseconds.

This measure the time from when the bus has deserialized by the bus to when the app's engine picks it up from it's input queue (before it dispatches it to an application) handler.

Additional time spent by the engine dispatching the message to the application handler is covered by msgPreProcLatencies (mpproc).


getOriginToReceiveLatencies

public final IStats.Latencies getOriginToReceiveLatencies()
Get the o2i (origin->receive) latencies in microseconds

The time in microseconds.from when the message was originally created to just after it was received.

Note: that this stat is subject to clock skew when the creating and receiving sides are on different hosts.


getWireToWireLatencies

public final IStats.Latencies getWireToWireLatencies()
Get the w2w (wire->wire) latencies, for outbound messages the time from inbound message receipt off the wire to after the outbound message was written to the wire.

For outbound messages the time from when the corresponding inbound message was received off the wire to when the outbound message was written to the wire. This measurement is useful for determine how long the process spent from receiving a message to making its effects to the world 'known'.

Returns:
wire to wire latencies.

reset

public final void reset()
Reset the latency manager


shutdown

public final void shutdown()
Shut down the latency stats manager



Copyright © 2016 Neeve Research, LLC. All Rights Reserved.