Apache Spark Big Data (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What are Watermarks in Spark Structured Streaming?
senior Levelapache-sparkAdvanced Internals
In Simple Words: A Watermark defines how long Spark waits for late-arriving streaming events before discarding them from state memory:
.withWatermark("timestamp", "10 minutes")instructs Spark that events arriving more than 10 minutes past the current event-time threshold can be dropped.- Prevents streaming state stores from expanding infinitely and running out of memory.