How can I troubleshoot latency issues in Azure Stream Analytics job output?

Stephen27 60 Reputation points
2025-05-27T18:46:40.6766667+00:00

I'm experiencing increased latency in the output of my Azure Stream Analytics job. The input is coming from an Event Hub and the output is going to an Azure SQL Database.

I’ve checked that the Event Hub is receiving data in near real-time, but the results are showing up in the SQL database with delays ranging from 2 to 5 minutes. The query in my job is relatively simple, mostly filtering and projecting fields, with no windowing functions.

Is there a recommended way to diagnose and resolve this kind of latency? Are there any common pitfalls in Stream Analytics that could cause such behavior?

Thanks in advance!

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

2 answers

Sort by: Most helpful
  1. Ganesh Gurram 7,140 Reputation points Microsoft External Staff Moderator
    2025-05-27T19:11:48.1133333+00:00

    @Stephen27

    To troubleshoot latency issues in your Azure Stream Analytics job output, consider the following steps:

    Check for Throttling - Ensure that neither the downstream sink (Azure SQL Database) nor the upstream source (Event Hub) is throttled. Throttling can lead to delays in processing and output.

    Examine Resource Utilization - Monitor the resource utilization of your Stream Analytics job. If resource utilization is consistently high (over 80%), it may indicate that the job is nearing its maximum allocated resources, which can contribute to latency. You might consider increasing the number of streaming units to improve throughput.

    Job Diagram Analysis - Use the job diagram in the Azure portal to visualize the flow of data and identify any bottlenecks. This can help you see if there are any backlogged events or if the processing logic is compute-intensive.

    Output Retry Logic - Be aware that the SQL output can experience transient errors which may cause delays. The job attempts to connect to SQL and fetch the schema, and any issues during this process can lead to increased latency.

    Common Pitfalls - Ensure that your query logic is not inadvertently filtering out events or causing delays. For example, check for any WHERE clauses that may be filtering out all events or for any casting errors that could prevent output from being generated.

    By following these steps, you should be able to diagnose and potentially resolve the latency issues you are experiencing.

    For more details refer: Troubleshoot Azure Stream Analytics outputs

    I hope this information helps.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    0 comments No comments

  2. Sander van de Velde | MVP 36,526 Reputation points MVP Volunteer Moderator
    2025-05-28T10:30:41.58+00:00

    Hello @Stephen27 ,

    welcome to this moderated Azure community forum.

    As already mentioned above, there can be multiple reasons why you experience latency.

    I would check the CPU usage first to see if the current number of streaming unit is still sufficient, eg. because the amount of messages has increased over time.

    You say you forward your messages to a Sql database. Check if this database performs as expected.

    In general a relational database is not optimized for data like telemetry. I suggest checking out Azure Data Explorer, a timeseries database that is optimized for insert only storage for immutable, events, observations, facts.

    If you have a test environment next to the production environment, please check if you can replay the same observations there.

    It's also recommended to tune the query using the Visual Studio code extension for Stream Analytics so you can test it before deployment..


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

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