Completeness Costs Latency and Memory
Ada re-derives this chapter’s own numbers step by step, at full precision
ADA · CALCULATION AUDIT
Completeness Costs Latency and Memory
A stream-processing line emits 200 candidate A events per second, and each partial match can wait up to 30 seconds for its matching B event, so the engine may need to track up to 6,000 pending A records for that one rule before expiration. The chapter notes that doubling the window doubles the worst-case state, and that an unbounded pattern is effectively a memory leak. This audit asks the question that raises: does widening the watermark’s allowed lateness to catch stragglers cost only latency, or does it also inflate the pending-match memory the window-doubling example already suggests?
Companion to the chapter Lab: Advanced CEP — every number here comes from that chapter.
Ada: The under-the-hood layer gives one worked state figure: a line emitting 200 candidate A events per second, each waiting up to 30 seconds for its B, needs up to 6,000 pending records. Let me check it, then push on the “doubling the window doubles the state” claim, because it hides a third cost the latency discussion does not name.
Worst-case pending state is just rate times retention:
200 events/s x 30 s = 6,000 pending A records- Double the window:
200 x 60 = 12,000, exactly double, as claimed - Unbounded window:
200 x (no limit)grows without bound, which is why “A eventually followed by B” is a memory leak, not a semantics quibble
Here is the connection the chapter sets up but does not close. The watermark’s allowed lateness, the completeness knob, is retention time. Raising it to catch stragglers lengthens the effective window, so a 30 s pattern with 30 s of allowed lateness holds partial matches for 30 + 30 = 60 s, i.e. 200 x 60 = 12,000 records. Turning the completeness knob therefore does not buy you latency alone; it also linearly inflates memory. The design-meaning: the latency-versus-completeness curve is really a three-way budget of timeliness, completeness, and pending-state memory, and the only lever that bounds the third is a finite window, which is why bounding it is about survival, not taste.
Every number above is taken from the chapter’s own material and re-derived step by step.