Event Time vs Processing Time
What you'll learn: How to distinguish between when streaming events actually happen and when your pipeline processes them — a critical concept for accurate analytics and late-arriving data.
Why Two Different Times?
In streaming systems, events don't always get processed the instant they occur. A mobile app might generate a click event while offline, network delays can slow transmission, or your processing pipeline might fall behind during load spikes.
Event Time is the timestamp when the event actually happened in the real world (when the user clicked, when the sensor read the temperature, when the transaction occurred).
Processing Time is when your streaming system receives and processes that event.
The Gap and Its Implications
These times often diverge significantly. Imagine a fitness tracker recording a run at 6 AM but syncing data at noon when WiFi connects — the event time is 6 AM, processing time is noon.
This gap creates challenges:
- Out-of-order arrival: Events from 10:05 might arrive after events from 10:10
- Late data: Yesterday's events might arrive today
- Windowing decisions: Should you count revenue by when sales happened or when you learned about them?
Choosing Your Time Dimension
Most accurate analytics use event time because it reflects reality: a 6 AM workout happened at 6 AM regardless of when you processed it. However, event time requires handling late arrivals and out-of-order processing.
Processing time is simpler and fine for use cases where "when we learned about it" matters more than "when it happened" — like real-time monitoring dashboards.
Modern streaming frameworks (recall Stream Processing Pattern from lesson 2511) let you specify which time dimension to use for windowing and aggregations.
Key Takeaway: Event time reflects when things actually happened; processing time reflects when your system saw them. Choose event time for accurate historical analysis, but prepare to handle late and out-of-order data.