Share via

Can the watermark go back in Azure Stream Analytics

Dhruv Singla 230 Reputation points
2026-03-07T14:34:20.2566667+00:00

The azure documentation for time handling in azure stream analytics states the following.

  • When there's any incoming event, the watermark is the largest event time Stream Analytics has seen so far minus the out-of-order tolerance window size.
  • When there's no incoming event, the watermark is the current estimated arrival time minus the late arrival tolerance window. The estimated arrival time is the time that has elapsed from the last time an input event was seen plus that input event's arrival time.

Suppose we have the following settings

  • out-of-order tolerance window is 2 minutes
  • late arrival tolerance window is 5 minutes

Now, suppose the following is sequence of events

Wall Clock Event Arrives WaterMark
10 : 00 Event 1 Max Event Time - Out of Order Window = 10:00 - 2 = 9:58
10 : 01 No Event Estimated Arrival Time - Late Arrival Tolerance = (1 + 10:00) - 5 = 9:56
10 : 02 No Event Estimated Arrival Time - Late Arrival Tolerance = (2 + 10:00) - 5 = 9:57

So, can the watermark go back as in the above example?

Azure Stream Analytics
Azure Stream Analytics

An Azure real-time analytics service designed for mission-critical workloads.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Manoj Kumar Boyini 11,685 Reputation points Microsoft External Staff Moderator
    2026-03-13T12:16:35.46+00:00

    Hi Dhruv Singla

    No—you won’t actually see the watermark move backwards in ASA. Even though the “idle” formula (current wall‐clock minus the late‐arrival window) can mathematically yield a lower timestamp than your last watermark, the engine always takes the max of “previous watermark” and “newly computed watermark.” In practice:

    • At 10:00 you saw Watermark = 10:00 (max event time) – 2 min = 9:58.
    • At 10:01 the idle formula gives 10:01 – 5 min = 9:56, but ASA will compare that with the existing 9:58 and keep 9:58.
    • Likewise at 10:02 the formula says 9:57—still behind 9:58, so watermark remains 9:58 until enough time elapses to push (wall‐clock – lateTolerance) above 9:58 (that happens at 10:03).

    Because of this “max(previous, computed)” behavior, your watermark is monotonic and never regresses.

    References

    1. Understand time handling in ASA (watermark definition & progression): https://docs.microsoft.com/azure/stream-analytics/stream-analytics-time-handling
    2. Illustrated example of watermarks in ASA: https://docs.microsoft.com/azure/stream-analytics/stream-analytics-time-handling#illustrated-example-of-watermarks
    3. Events dropped when arriving outside allowed time policy: https://docs.microsoft.com/azure/stream-analytics/stream-analytics-time-handling#how-time-progresses-in-azure-stream-analytics

  2. Marcin Policht 85,420 Reputation points MVP Volunteer Moderator
    2026-03-07T15:08:23.59+00:00

    AFAIK, the watermark in Azure Stream Analytics is monotonic per input partition or substream, meaning it can only stay the same or move forward in time, but it cannot move backward. This is because both the max(event time seen so far) and the estimated arrival time are non-decreasing:

    • max(event time seen so far): This value can only stay the same or increase as new events arrive with later event times. It cannot decrease.
    • estimated arrival time: This value is calculated based on the last event's arrival time plus the elapsed wall-clock time since the event was processed. As time progresses, this value will only increase, as it is based on a non-decreasing wall-clock time.

    Since the watermark is derived from these non-decreasing quantities, after applying the out-of-order and late arrival tolerance windows, the watermark itself will either stay the same or increase but will never decrease.

    In your example, with the out-of-order tolerance and late arrival tolerance windows, the watermark will not go from 09:58 to 09:56. Instead, once the watermark reaches 09:58, it will either remain at 09:58 or move forward, but it will not move backward to 09:56.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.