To use Latency, the Latency Feature must be installed.
Latency describes the time how long it takes for an event from entering the system until it triggers a result. In Odysseus, latency time stamps are added to each event (if latency mode is activated). This is the system time in nano seconds, when the event is received. As long as only one event is involved in the creation of a result, the latency is not manipulated. If the result is the combination of different events (as for the aggregation or for the join), the latency is typically dened as the latency of the last participating event. This is because the waiting time of an event for its corresponding event in another stream depends not on the processing capability of the system but the data distribution. Although, for some applications it might be interesting how long the oldest participating event is been processed. For this issue, Odysseus keeps both values as meta data.
In Odysseus, a special CalcLatency operator is needed to get the real latency values whereever the current latency should be calculated. For most queries, this should always be done before the last operation (e.g., before writing the result to sinks).
You can access the meta data from every stream element (e.g. in MEP or in Select operator) with
Latency.minlstart: This is the youngest timestamp in nano seconds of an element that is part of the calculation. Latency is the difference between lend and minlstart.
Latency.maxlstart:This is the oldest timestamp in nano seconds of an element that is part of the calculation. This information can be used to find out how long an element has been waiting for another element before it was processed.
Latency.lend:This value is set by the CalcLatency operator and contains the current system time stamp in nano seconds.
Latency.latency: This is short for lend-minlstart
Latency.Measurements: A possibly empty list, contain key value pairs of measurementPoint and LatencyEnd. These value are are by the CalcLatency operator.
The usage of Latency can be defined in Odysseus Script with the #METADATA command or in the Access operator with the METAATTRIBUTE parameter.
Note, that the timestamps in minlstart, etc. do not have any relation to the stream time or system time. It is just a measurement of the JVM since some point in time. For further details on this topic, see https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#nanoTime-- .