Sunday, October 28, 2007

Time Synchronization and Event Processing

When processing events, especially when dealing with event occurrence and sequence, time becomes an important factor. Given events A and B their time of occurrence could be tricky to compare especially when generated from multiple sources. Time would have to synchronized for both sources in order to compare time(A) and time(B) to be able to determine if time(A) < time(B), which is to say that event A occurred before event B.

But then even if we managed to synchronize time say to the millisecond or some microseconds, what happens if both events occur within or close to the resolution of the time synchronization which is to say that events occurred "simultaneously".

It would also seem that CEP processor would have to be aware of the synchronized time resolution in order to judge whether two events qualify as A < B or A <= B. A <=B would be true of the difference in occurrence is equal or less to the resolution of the time synchronization.

Another approach is to treat event occurrence to be the time of reception by the CEP processor, where all time stamps are based on the CEP time and no synchronization is required. Although, this method is highly sensitive to event discovery and delivery latencies, which is a problem in most instances.

2 comments:

Adrian said...

To identify the order of the events, in most of the real world scenarios, comparing the events timestamp can be approximate using a jitter interval. Using this method of time comparison and the process definition of those events the order of the events is determined with high accuracy.

Bob said...

Time synchronization protocols like NTP estimate the offset between any pair of synchronized clocks, but it also tracks the uncertainty of the estimate. Thus it may be certain that A happened before or after B if the time difference is greater than the offset plus the uncertainty. But if the time difference is less than the offset +/- the uncertainty their order is uncertain. For some applications, you might want to classify them as happening at the same time, but the ordering really isn't knowable.