How does session window max duration check work in Stream Analytics ?

Ahan Sarkar 0 Reputation points
2024-05-11T09:20:08.6133333+00:00

Hi, I have a question regarding the Session Window function in Stream Analytics.

According to documentation I found, "If events keep occurring within the specified timeout, the session window will keep extending until maximum duration is reached. Please note that the maximum duration checking intervals are set to be the same size as the specified max duration. For example, if the max duration is 10, then the checks on if the window exceed maximum duration will happen at t = 0, 10, 20, 30, etc. That means that the actual duration of a session window could then be up to twice maxDuration."

So is the check time based on when the first session window opened? For example, there was an event at t=0, and a session window was started with timeout of 5 minutes and max duration of 10. Another event came in at t=3, which is within timeout so the window was extended by 5 minutes. No further events came in, so the window closed at t=8.
Will a max duration check for any violations be done at t=10?

If a new event comes in at t=13, a new session window will start, the next event comes in at t=15, then t=20, since none of the events passed the timeout, the window was extended. Will another max duration check be done at t=20 ? In that case, since the window as been open for only 7 minutes, the window will continue beyond until the next check at t=20, so if more events come in, then the window size can exceed 10 minutes.

Is my understanding of this correct ?

Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
334 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,126 Reputation points Microsoft Employee
    2024-05-13T06:54:58.87+00:00

    Hi

    Thank you for posting query in Microsoft Q&A Platform.

    Yes, your understanding of the Session Window function in Stream Analytics is correct.

    The check for maximum duration violations is based on the time when the first session window opened. In your example, if the first event came in at t=0 and a session window was started with a timeout of 5 minutes and a max duration of 10, then a check for maximum duration violations will be done at t=10.

    If a new event comes in at t=13 and a new session window starts, then the next event comes in at t=15 and then at t=20, a check for maximum duration violations will be done at t=20. Since the window has been open for only 7 minutes, the window will continue beyond until the next check at t=20. If more events come in, then the window size can exceed 10 minutes.

    It's important to note that the maximum duration checking intervals are set to be the same size as the specified max duration. So, in your example, the checks on if the window exceeds maximum duration will happen at t=0, 10, 20, 30, etc. This means that the actual duration of a session window could then be up to twice maxDuration.

    I hope this helps! Let me know if you have any further questions.

    1 person found this answer helpful.