This document discusses lessons learned from working with Spark's machine learning library (ML Lib) for collaborative filtering on a large dataset. It covers four main lessons: 1. Spark uses more memory than expected due to JVM overhead, metadata for shuffles and jobs, and Scala vs Java. This can be addressed through careful partitioning, serialization with Kryo, and cleaning up long-running jobs. 2. Shuffles between nodes are expensive and can cause out of memory errors, so it is best to avoid them by using the driver for collection, broadcast variables, and accumulators. 3. Sending data through the driver has memory limits, so partitions and akka frame sizes must be configured based