Mediation time - the time taken to mediate a single message through a given component. It is one of the key variables captured and processed by the ESB. When you have enabled statistics on a sequence, proxy service samples, or an endpoint, the ESB measures the mediation time for that component, for each message passing through it. In case of sequences and Proxy Services, request mediation time and response mediation time will be measured separately. Based on the measured values, ESB calculates three useful statistics:
- Minimum time
- Maximum time
- Average time
Considering the functional differences between the three types of mediation components, WSO2 ESB follows different strategies to measure the mediation time for sequences, Proxy Services and endpoints.
The request mediation time for a sequence is the time taken to process a request through all the mediators in the sequence. If the sequence consists of a Send Mediator, which sends the request to a remote service, the time taken to send the message and receive a response is also added to the request mediation time. In case of a Proxy Service, the request mediation time is the time spent on mediating a message through the in-sequence plus the time taken to forward the request to the target endpoint and receive a response.
The request mediation time for an endpoint is, simply, the time taken to send the message to the remote server and receive a response. Due to the way the endpoint mediation time is measured, the resulting values serve as performance indicators of the backend services.
The response mediation times for sequences and Proxy Services are measured from the moment the responses are received by the mediation engine. Response mediation time is generally the time taken to process a response message through the relevant mediators, or in case of Proxy Services, through the out-sequence.
Typically, in Proxy Services and sequences, the requests are sent to a backend service for further processing, and the responses are simply routed back to the client. In such scenarios, the request mediation time will include the time taken to send the message to the backend service and receive a response. The response mediation time, however, will only consist of the time taken to process the response through the service bus alone. As a result, in most practical scenarios, the request mediation time is much greater than the corresponding response mediation time. This concept is further illustrated by the following equations:
Request mediation time = Time to mediate request through the ESB + Time to send request to backend service + Time for backend service to process request + Time to send response back to the ESB
Response mediation time = Time to mediate response through the ESB
In case of simple sequences and proxy services, the mediation time could be very small. It could even take values less than 1 ms. When it happens, the statistics collector will report the mediation time as 0 ms.