Package org.apache.synapse.transport.nhttp.util

## Class LatencyView

- java.lang.Object
- - org.apache.synapse.transport.nhttp.util.LatencyView

- All Implemented Interfaces:
    `LatencyViewMBean`

      public class LatencyView
      extends Object
      implements LatencyViewMBean

  LatencyView provides statistical information related to the latency (overhead) incurred by the Synapse NHTTP transport, when mediating messages back and forth. Statistics are available under two main categories, namely short term data and long term data. Short term data is statistical information related to the last 15 minutes of execution and these metrics are updated every 5 seconds. Long term data is related to the last 24 hours of execution and they are updated every 5 minutes. Two timer tasks and a single threaded scheduled executor is used to perform these periodic calculations.

  Latency calculation for a single invocation is carried out by taking timestamps on following events:

  - t1 - Receiving a new request (ServerHandler#requestReceived)
  - t2 - Obtaining a connection to forward the request (ClientHandler#processConnection)
  - t3 - Reading the complete response from the backend server (ClientHandler#inputReady)
  - t4 - Writing the complete response to the client (ServerHandler#outputReady)

  Having taken these timestamps, the latency for the invocation is calculated as follows:
  Latency = (t4 - t1) - (t3 - t2)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LatencyView​(String latencyMode, boolean isHttps)` |
    `LatencyView​(String latencyMode, boolean isHttps, String namePostfix, boolean showAdvancedParameters)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `destroy()` |
    `double` | `get15m_Avg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `get15m_Avg_Client_To_Esb_RequestReadTime()` |
    `double` | `get15m_Avg_ClientWorker_QueuedTime()` |
    `double` | `get15m_Avg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `get15m_Avg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `get15m_Avg_Latency()` |
    `double` | `get15m_Avg_Latency_BackEnd()` |
    `double` | `get15m_Avg_request_Mediation_Latency()` |
    `double` | `get15m_Avg_response_Mediation_Latency()` |
    `double` | `get15m_Avg_ServerWorker_QueuedTime()` |
    `double` | `get1h_Avg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `get1h_Avg_Client_To_Esb_RequestReadTime()` |
    `double` | `get1h_Avg_ClientWorker_QueuedTime()` |
    `double` | `get1h_Avg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `get1h_Avg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `get1h_Avg_Latency()` |
    `double` | `get1h_Avg_Latency_BackEnd()` |
    `double` | `get1h_Avg_request_Mediation_Latency()` |
    `double` | `get1h_Avg_response_Mediation_Latency()` |
    `double` | `get1h_Avg_ServerWorker_QueuedTime()` |
    `double` | `get1m_Avg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `get1m_Avg_Client_To_Esb_RequestReadTime()` |
    `double` | `get1m_Avg_ClientWorker_QueuedTime()` |
    `double` | `get1m_Avg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `get1m_Avg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `get1m_Avg_Latency()` | 1m averages
    `double` | `get1m_Avg_Latency_BackEnd()` |
    `double` | `get1m_Avg_request_Mediation_Latency()` |
    `double` | `get1m_Avg_response_Mediation_Latency()` |
    `double` | `get1m_Avg_ServerWorker_QueuedTime()` |
    `double` | `get24h_Avg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `get24h_Avg_Client_To_Esb_RequestReadTime()` |
    `double` | `get24h_Avg_ClientWorker_QueuedTime()` |
    `double` | `get24h_Avg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `get24h_Avg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `get24h_Avg_Latency()` |
    `double` | `get24h_Avg_Latency_BackEnd()` |
    `double` | `get24h_Avg_request_Mediation_Latency()` |
    `double` | `get24h_Avg_response_Mediation_Latency()` |
    `double` | `get24h_Avg_ServerWorker_QueuedTime()` |
    `double` | `get5m_Avg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `get5m_Avg_Client_To_Esb_RequestReadTime()` |
    `double` | `get5m_Avg_ClientWorker_QueuedTime()` |
    `double` | `get5m_Avg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `get5m_Avg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `get5m_Avg_Latency()` |
    `double` | `get5m_Avg_Latency_BackEnd()` |
    `double` | `get5m_Avg_request_Mediation_Latency()` |
    `double` | `get5m_Avg_response_Mediation_Latency()` |
    `double` | `get5m_Avg_ServerWorker_QueuedTime()` |
    `double` | `get8h_Avg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `get8h_Avg_Client_To_Esb_RequestReadTime()` |
    `double` | `get8h_Avg_ClientWorker_QueuedTime()` |
    `double` | `get8h_Avg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `get8h_Avg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `get8h_Avg_Latency()` |
    `double` | `get8h_Avg_Latency_BackEnd()` |
    `double` | `get8h_Avg_request_Mediation_Latency()` |
    `double` | `get8h_Avg_response_Mediation_Latency()` |
    `double` | `get8h_Avg_ServerWorker_QueuedTime()` |
    `double` | `getAvg_BackEnd_To_Esb_ResponseReadTime()` |
    `double` | `getAvg_Client_To_Esb_RequestReadTime()` |
    `double` | `getAvg_ClientWorker_QueuedTime()` |
    `double` | `getAvg_Esb_To_BackEnd_RequestWriteTime()` |
    `double` | `getAvg_Esb_To_Client_ResponseWriteTime()` |
    `double` | `getAvg_Latency()` | All time averages
    `double` | `getAvg_Latency_BackEnd()` |
    `double` | `getAvg_request_Mediation_Latency()` |
    `double` | `getAvg_response_Mediation_Latency()` |
    `double` | `getAvg_ServerWorker_QueuedTime()` |
    `Date` | `getLastResetTime()` |
    `void` | `notifyTimes​(LatencyCollector collector)` |
    `void` | `reset()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LatencyView

          public LatencyView​(String latencyMode,
                             boolean isHttps)

    - #### LatencyView

          public LatencyView​(String latencyMode,
                             boolean isHttps,
                             String namePostfix,
                             boolean showAdvancedParameters)

  - ### Method Detail

    - #### destroy

          public void destroy()

    - #### notifyTimes

          public void notifyTimes​(LatencyCollector collector)

    - #### getAvg_Latency

          public double getAvg_Latency()

      Description copied from interface: `LatencyViewMBean`
      All time averages
      Specified by:
        `getAvg_Latency` in interface `LatencyViewMBean`

    - #### getAvg_Client_To_Esb_RequestReadTime

          public double getAvg_Client_To_Esb_RequestReadTime()

      Specified by:
        `getAvg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### getAvg_Esb_To_BackEnd_RequestWriteTime

          public double getAvg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `getAvg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### getAvg_BackEnd_To_Esb_ResponseReadTime

          public double getAvg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `getAvg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### getAvg_Esb_To_Client_ResponseWriteTime

          public double getAvg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `getAvg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_Client_To_Esb_RequestReadTime

          public double get1m_Avg_Client_To_Esb_RequestReadTime()

      Specified by:
        `get1m_Avg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_Esb_To_BackEnd_RequestWriteTime

          public double get1m_Avg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `get1m_Avg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_BackEnd_To_Esb_ResponseReadTime

          public double get1m_Avg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `get1m_Avg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_Esb_To_Client_ResponseWriteTime

          public double get1m_Avg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `get1m_Avg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### get5m_Avg_Client_To_Esb_RequestReadTime

          public double get5m_Avg_Client_To_Esb_RequestReadTime()

      Specified by:
        `get5m_Avg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### get5m_Avg_Esb_To_BackEnd_RequestWriteTime

          public double get5m_Avg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `get5m_Avg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### get5m_Avg_BackEnd_To_Esb_ResponseReadTime

          public double get5m_Avg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `get5m_Avg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### get5m_Avg_Esb_To_Client_ResponseWriteTime

          public double get5m_Avg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `get5m_Avg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### get15m_Avg_Client_To_Esb_RequestReadTime

          public double get15m_Avg_Client_To_Esb_RequestReadTime()

      Specified by:
        `get15m_Avg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### get15m_Avg_Esb_To_BackEnd_RequestWriteTime

          public double get15m_Avg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `get15m_Avg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### get15m_Avg_BackEnd_To_Esb_ResponseReadTime

          public double get15m_Avg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `get15m_Avg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### get15m_Avg_Esb_To_Client_ResponseWriteTime

          public double get15m_Avg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `get15m_Avg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### getAvg_ClientWorker_QueuedTime

          public double getAvg_ClientWorker_QueuedTime()

      Specified by:
        `getAvg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_ClientWorker_QueuedTime

          public double get1m_Avg_ClientWorker_QueuedTime()

      Specified by:
        `get1m_Avg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get5m_Avg_ClientWorker_QueuedTime

          public double get5m_Avg_ClientWorker_QueuedTime()

      Specified by:
        `get5m_Avg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get15m_Avg_ClientWorker_QueuedTime

          public double get15m_Avg_ClientWorker_QueuedTime()

      Specified by:
        `get15m_Avg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### getAvg_ServerWorker_QueuedTime

          public double getAvg_ServerWorker_QueuedTime()

      Specified by:
        `getAvg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_ServerWorker_QueuedTime

          public double get1m_Avg_ServerWorker_QueuedTime()

      Specified by:
        `get1m_Avg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get5m_Avg_ServerWorker_QueuedTime

          public double get5m_Avg_ServerWorker_QueuedTime()

      Specified by:
        `get5m_Avg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get15m_Avg_ServerWorker_QueuedTime

          public double get15m_Avg_ServerWorker_QueuedTime()

      Specified by:
        `get15m_Avg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get1m_Avg_Latency

          public double get1m_Avg_Latency()

      Description copied from interface: `LatencyViewMBean`
      1m averages
      Specified by:
        `get1m_Avg_Latency` in interface `LatencyViewMBean`

    - #### get5m_Avg_Latency

          public double get5m_Avg_Latency()

      Specified by:
        `get5m_Avg_Latency` in interface `LatencyViewMBean`

    - #### get15m_Avg_Latency

          public double get15m_Avg_Latency()

      Specified by:
        `get15m_Avg_Latency` in interface `LatencyViewMBean`

    - #### get1h_Avg_Latency

          public double get1h_Avg_Latency()

      Specified by:
        `get1h_Avg_Latency` in interface `LatencyViewMBean`

    - #### get8h_Avg_Latency

          public double get8h_Avg_Latency()

      Specified by:
        `get8h_Avg_Latency` in interface `LatencyViewMBean`

    - #### get24h_Avg_Latency

          public double get24h_Avg_Latency()

      Specified by:
        `get24h_Avg_Latency` in interface `LatencyViewMBean`

    - #### getAvg_Latency_BackEnd

          public double getAvg_Latency_BackEnd()

      Specified by:
        `getAvg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get1m_Avg_Latency_BackEnd

          public double get1m_Avg_Latency_BackEnd()

      Specified by:
        `get1m_Avg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get5m_Avg_Latency_BackEnd

          public double get5m_Avg_Latency_BackEnd()

      Specified by:
        `get5m_Avg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get15m_Avg_Latency_BackEnd

          public double get15m_Avg_Latency_BackEnd()

      Specified by:
        `get15m_Avg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get1h_Avg_Latency_BackEnd

          public double get1h_Avg_Latency_BackEnd()

      Specified by:
        `get1h_Avg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get8h_Avg_Latency_BackEnd

          public double get8h_Avg_Latency_BackEnd()

      Specified by:
        `get8h_Avg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get24h_Avg_Latency_BackEnd

          public double get24h_Avg_Latency_BackEnd()

      Specified by:
        `get24h_Avg_Latency_BackEnd` in interface `LatencyViewMBean`

    - #### get1h_Avg_Client_To_Esb_RequestReadTime

          public double get1h_Avg_Client_To_Esb_RequestReadTime()

      Specified by:
        `get1h_Avg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### get1h_Avg_Esb_To_BackEnd_RequestWriteTime

          public double get1h_Avg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `get1h_Avg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### get1h_Avg_BackEnd_To_Esb_ResponseReadTime

          public double get1h_Avg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `get1h_Avg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### get1h_Avg_Esb_To_Client_ResponseWriteTime

          public double get1h_Avg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `get1h_Avg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### get1h_Avg_ServerWorker_QueuedTime

          public double get1h_Avg_ServerWorker_QueuedTime()

      Specified by:
        `get1h_Avg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get1h_Avg_ClientWorker_QueuedTime

          public double get1h_Avg_ClientWorker_QueuedTime()

      Specified by:
        `get1h_Avg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get8h_Avg_Client_To_Esb_RequestReadTime

          public double get8h_Avg_Client_To_Esb_RequestReadTime()

      Specified by:
        `get8h_Avg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### get8h_Avg_Esb_To_BackEnd_RequestWriteTime

          public double get8h_Avg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `get8h_Avg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### get8h_Avg_BackEnd_To_Esb_ResponseReadTime

          public double get8h_Avg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `get8h_Avg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### get8h_Avg_Esb_To_Client_ResponseWriteTime

          public double get8h_Avg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `get8h_Avg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### get8h_Avg_ServerWorker_QueuedTime

          public double get8h_Avg_ServerWorker_QueuedTime()

      Specified by:
        `get8h_Avg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get8h_Avg_ClientWorker_QueuedTime

          public double get8h_Avg_ClientWorker_QueuedTime()

      Specified by:
        `get8h_Avg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get24h_Avg_Client_To_Esb_RequestReadTime

          public double get24h_Avg_Client_To_Esb_RequestReadTime()

      Specified by:
        `get24h_Avg_Client_To_Esb_RequestReadTime` in interface `LatencyViewMBean`

    - #### get24h_Avg_Esb_To_BackEnd_RequestWriteTime

          public double get24h_Avg_Esb_To_BackEnd_RequestWriteTime()

      Specified by:
        `get24h_Avg_Esb_To_BackEnd_RequestWriteTime` in interface `LatencyViewMBean`

    - #### get24h_Avg_BackEnd_To_Esb_ResponseReadTime

          public double get24h_Avg_BackEnd_To_Esb_ResponseReadTime()

      Specified by:
        `get24h_Avg_BackEnd_To_Esb_ResponseReadTime` in interface `LatencyViewMBean`

    - #### get24h_Avg_Esb_To_Client_ResponseWriteTime

          public double get24h_Avg_Esb_To_Client_ResponseWriteTime()

      Specified by:
        `get24h_Avg_Esb_To_Client_ResponseWriteTime` in interface `LatencyViewMBean`

    - #### get24h_Avg_ServerWorker_QueuedTime

          public double get24h_Avg_ServerWorker_QueuedTime()

      Specified by:
        `get24h_Avg_ServerWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### get24h_Avg_ClientWorker_QueuedTime

          public double get24h_Avg_ClientWorker_QueuedTime()

      Specified by:
        `get24h_Avg_ClientWorker_QueuedTime` in interface `LatencyViewMBean`

    - #### getAvg_request_Mediation_Latency

          public double getAvg_request_Mediation_Latency()

      Specified by:
        `getAvg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### getAvg_response_Mediation_Latency

          public double getAvg_response_Mediation_Latency()

      Specified by:
        `getAvg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get1m_Avg_request_Mediation_Latency

          public double get1m_Avg_request_Mediation_Latency()

      Specified by:
        `get1m_Avg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get1m_Avg_response_Mediation_Latency

          public double get1m_Avg_response_Mediation_Latency()

      Specified by:
        `get1m_Avg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get5m_Avg_request_Mediation_Latency

          public double get5m_Avg_request_Mediation_Latency()

      Specified by:
        `get5m_Avg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get5m_Avg_response_Mediation_Latency

          public double get5m_Avg_response_Mediation_Latency()

      Specified by:
        `get5m_Avg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get15m_Avg_request_Mediation_Latency

          public double get15m_Avg_request_Mediation_Latency()

      Specified by:
        `get15m_Avg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get15m_Avg_response_Mediation_Latency

          public double get15m_Avg_response_Mediation_Latency()

      Specified by:
        `get15m_Avg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get1h_Avg_request_Mediation_Latency

          public double get1h_Avg_request_Mediation_Latency()

      Specified by:
        `get1h_Avg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get1h_Avg_response_Mediation_Latency

          public double get1h_Avg_response_Mediation_Latency()

      Specified by:
        `get1h_Avg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get8h_Avg_request_Mediation_Latency

          public double get8h_Avg_request_Mediation_Latency()

      Specified by:
        `get8h_Avg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get8h_Avg_response_Mediation_Latency

          public double get8h_Avg_response_Mediation_Latency()

      Specified by:
        `get8h_Avg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get24h_Avg_request_Mediation_Latency

          public double get24h_Avg_request_Mediation_Latency()

      Specified by:
        `get24h_Avg_request_Mediation_Latency` in interface `LatencyViewMBean`

    - #### get24h_Avg_response_Mediation_Latency

          public double get24h_Avg_response_Mediation_Latency()

      Specified by:
        `get24h_Avg_response_Mediation_Latency` in interface `LatencyViewMBean`

    - #### reset

          public void reset()

      Specified by:
        `reset` in interface `LatencyViewMBean`

    - #### getLastResetTime

          public Date getLastResetTime()

      Specified by:
        `getLastResetTime` in interface `LatencyViewMBean`