Day 25 - Hybrid Robustness & Update Coalescing¶
Overview¶
This chapter enhances the hybrid (IRQ + polling) model by introducing:
- Update coalescing
- Global cooldown policy
- Detailed runtime observability
The goal is to prevent excessive updates while maintaining data freshness.
Key Concepts¶
1. Event vs Update vs Skip¶
Each trigger (IRQ / polling / on-demand) is categorized into:
- Event: trigger occurs
- Update: cache is refreshed
- Skip: update is suppressed by policy
2. Global Cooldown¶
A new parameter:
Defines the minimum time between two successful updates.
Behavior:
- If last update is too recent → skip
- Applies to ALL triggers (IRQ / poll / on-demand)
3. Update Policy¶
Final decision logic:
4. Trigger-specific Rules¶
IRQ¶
- Allowed when
irq_enable == true - No intrinsic interval limit
- Controlled mainly by cooldown
Polling¶
- Allowed when
polling_enable == true - Uses
polling_interval_ms - In hybrid mode:
- Acts as fallback when data is stale
On-demand¶
- Active only when IRQ and polling are disabled
- Uses
cache_interval_ms
5. Cooldown Helper¶
Responsibilities:
- Check elapsed time since last update
- Compare with
min_update_interval_ms - Return whether update should be suppressed
Observability Design¶
New counters:
IRQ¶
- irq_event_count
- irq_update_count
- irq_skip_count
Polling¶
- poll_event_count
- poll_update_count
- poll_skip_count
On-demand¶
- ondemand_update_count
- ondemand_skip_count
Debug Interface¶
Example:
mode=hybrid
irq_event_count=924
irq_update_count=82
irq_skip_count=842
poll_event_count=356
poll_update_count=239
poll_skip_count=116
This allows clear analysis of:
- Trigger frequency
- Update efficiency
- Coalescing effectiveness
Design Insights¶
- IRQ may generate frequent events but be heavily rate-limited
- Polling provides stability under high IRQ load
- Cooldown acts as a global rate limiter
- System favors "eventual consistency" over strict immediacy
Key Takeaways¶
- Separate event, update, and skip metrics
- Use cooldown to prevent redundant work
- Hybrid systems require careful policy layering
- Observability is essential for debugging behavior