Thanks for using Microsoft Q&A forum and posting your query.
The differences in CPU utilization between your two Stream Analytics jobs can be attributed to several factors, particularly the complexity of the job processing logic and how it handles data. Here are some key points to consider:
- Complexity of Query Logic: The job processing 10k events has a more complex topology, which includes more temporary tables and outputs. This complexity can lead to higher CPU utilization because the system has to manage more state and perform additional computations, even if the input event rate is lower.
- Stateful Processing: Stream Analytics jobs often use stateful operations (like windowed aggregates and temporal joins) that require maintaining state in memory. If your complex job has many such operations, it can consume more CPU resources, leading to higher utilization.
- Data Skew: If the input data is unevenly distributed across partitions, some partitions may experience a higher load than others. This can cause certain streaming nodes to become overloaded, resulting in increased CPU utilization and potential backlogs.
- Streaming Units (SUs): While the SU utilization is low (15%), it’s important to note that CPU utilization can still be high if the job is not efficiently utilizing the available resources. If the job is not fully parallelized, increasing the number of SUs might help distribute the workload more evenly and reduce CPU load.
- Watermark Delay and Backlogs: High CPU utilization often correlates with increased watermark delays and backlogged events. If the job cannot keep up with the input rate, it may struggle to process events in a timely manner, leading to backlogs.
Recommendations:
- Optimize Query Logic: Simplify the query where possible, reducing the number of temporary tables or complex joins.
- Repartition Input Data: Ensure that input data is evenly distributed across partitions to avoid data skew.
- Monitor Metrics: Keep an eye on CPU and SU utilization metrics to identify patterns and adjust resources accordingly.
- Scale Up SUs: Consider increasing the number of streaming units to provide more resources for processing.
Reference: https://learn.microsoft.com/en-us/azure/stream-analytics/stream-analytics-streaming-unit-consumption