Event Time vs Processing Time in Data Pipelines
A practical enterprise data modeling pattern or illustrative case study.
Event time is when the event occurred according to its timestamp. Processing time is when a pipeline stage handled it. Network delay, retries and source batching can make them diverge. Record the timestamp source and timezone so its meaning is understood.
Two clocks answer different questions
Event time is when the event occurred according to its timestamp. Processing time is when a pipeline stage handled it. Network delay, retries and source batching can make them diverge. Record the timestamp source and timezone so its meaning is understood.
Choose a windowing basis
Use event time when results should reflect when activity happened; use processing time for operational latency or arrival-based triggers. A pipeline may use both for different outputs. State window boundaries, allowed lateness and whether early results are provisional.
Handle late and out-of-order records
A watermark estimates completeness for event-time windows; it is not proof that no earlier event can arrive. Define allowed lateness, correction or retraction behavior and the point when results are considered final. Apache Beam explains event time, processing time, watermarks and triggers in its Apache Beam basics.
Test temporal edge cases
Test clock skew, duplicate events, daylight changes, late backfills, empty windows and events around boundaries. Make downstream consumers aware of provisional and corrected values. Monitor event-to-processing delay separately from pipeline execution time.
Apply the pattern
Confirm business meaning, workload, ownership and constraints with the people responsible for the system and its consumers. Use representative test cases and record assumptions, exceptions and change responsibilities.
Define the clocks in the pipeline
Event time is when the business event occurred; processing time is when a system handled it; ingestion time is when a platform received it. Source update time may be different again. Name each timestamp and preserve only those needed to answer operational, analytical or audit questions. Avoid a generic timestamp when multiple clocks exist.
Choose window and lateness rules
Window boundaries, timezones and allowed lateness determine when a result is considered complete. State whether endpoints are inclusive, how daylight-saving transitions are handled and what happens to events received after the watermark. A late event may update an output, emit a correction or be routed separately.
Monitor timestamp quality
Track event-to-ingestion delay, future or implausible timestamps, clock drift, duplicate IDs and out-of-order arrivals. Distinguish a source clock problem from pipeline congestion. Use samples and source context to investigate without exposing sensitive payloads unnecessarily.
Test temporal boundaries
Include events just before, exactly at and after a window boundary; delayed events; duplicates; timezone offsets; and a correction to a closed period. Verify results with hand-calculated expectations and document restatement behavior.
- Are event, process and ingestion times distinct?
- Are window boundaries and timezones defined?
- Is allowed lateness tied to consumer needs?
- Are corrections and duplicates handled predictably?
- Can operators identify clock and pipeline failures?
Worked example: late event in a time window
An event occurs at 10:02 but arrives at 10:17 after the pipeline has closed a 10:00–10:10 window. Event time places it in the earlier interval; processing time places it in the later one. Choose based on the business question and define a lateness allowance, correction policy, and when results become final. A dashboard should distinguish provisional from finalized values if late events can revise totals.
Retain source event time, receipt time, processing time, timezone or offset, and event identity. Define how to handle clocks that are skewed, missing, or inconsistent. Out-of-order delivery and replay should not double-count events. Test events at exact window boundaries and daylight-saving transitions.
Measure completeness and correction cost
Track observed arrival delay and the share of records arriving after the chosen cutoff. Review whether the lateness threshold balances user need with operational cost. Provide a backfill or correction route when late data exceeds it. Keep the policy explicit so consumers do not assume that a closed window can never change.
Document the pipeline time contract
Publish event-time source, accepted timezone formats, processing-time definition, lateness window, finalization rule, and correction behavior. Consumers should know whether a window may be revised. Preserve the watermark or checkpoint used to decide completeness.
Monitor clock skew, arrival delay, late-event proportion, and restatement frequency. Reassess the window with observed data and business tolerance. Test daylight-saving boundaries, replay, and out-of-order batches after platform changes.
Monitoring signals for event time
Track event-to-arrival delay percentiles, processing lag, late-event rate, watermark progress, and correction volume. Set alert thresholds based on consumer impact and normal source variation. Distinguish a source clock problem from a transport delay.
Review samples of late and out-of-order events and test downstream restatement. Communicate when windows are provisional. Use observed data to recalibrate policies, not to hide incomplete processing.