Apache Spark Big Data (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is the difference between Checkpointing and Caching in Spark?
senior LevelMost AskedSystem Design
In Simple Words:
cache(): Keeps DataFrame partitions in memory or local disk. Preserves the lineage graph; if an executor crashes, Spark re-evaluates the lineage.checkpoint(): Truncates the lineage graph completely and saves physical data to durable distributed storage (HDFS/S3). Critical for long iterative algorithms (e.g. GraphX, Machine Learning) where lineages grow to thousands of stages and cause stack overflow.