0
0
SCADA systemsdevops~5 mins

Polling vs report-by-exception in SCADA systems - Performance Comparison

Choose your learning style9 modes available
Time Complexity: Polling vs report-by-exception
O(n)
Understanding Time Complexity

We want to understand how the time cost changes when a SCADA system checks data regularly versus only when changes happen.

How does the method of getting data affect the work done as the system grows?

Scenario Under Consideration

Analyze the time complexity of the following code snippet.


// Polling method
while (true) {
  for (int i = 0; i < sensors.count; i++) {
    readData(sensors[i]);
  }
  wait(pollInterval);
}

// Report-by-exception method
onDataChange(sensor) {
  sendUpdate(sensor);
}

This code shows two ways to get sensor data: polling all sensors regularly, or only sending data when a sensor changes.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Polling loops over all sensors repeatedly; report-by-exception triggers only on changes.
  • How many times: Polling runs for every poll interval over all sensors; report-by-exception runs only when a sensor changes.
How Execution Grows With Input

Explain the growth pattern intuitively.

Input Size (n)Approx. Operations (Polling)Approx. Operations (Report-by-exception)
10 sensors10 reads per pollDepends on changes, possibly fewer
100 sensors100 reads per pollDepends on changes, often fewer than 100
1000 sensors1000 reads per pollDepends on changes, usually much fewer than 1000

Pattern observation: Polling work grows directly with number of sensors every time. Report-by-exception work grows only with how many sensors change.

Final Time Complexity

Time Complexity: O(n)

This means polling checks every sensor each time, so work grows linearly with sensor count. Report-by-exception work depends on changes, not total sensors.

Common Mistake

[X] Wrong: "Report-by-exception always uses less time than polling because it only sends updates on changes."

[OK] Correct: If many sensors change often, report-by-exception can generate as much or more work than polling.

Interview Connect

Understanding how data collection methods scale helps you design efficient systems and explain your choices clearly in real projects.

Self-Check

"What if sensors report changes in batches instead of individually? How would that affect the time complexity?"