Abstract
As big data analytics becomes increasingly central to scientific research, there is a growing interest in deploying cloud-native frameworks like Apache Spark on high-performance computing (HPC) infrastructure. This study evaluates the performance and scalability of Apache Spark against traditional MPI/C implementations on large-scale supercomputers, specifically the Theta and Cooley clusters at Argonne National Laboratory. While Spark offers a more accessible programming model and robust fault tolerance, it faces significant performance overheads—up to 30x slower than MPI—primarily due to networking stack inefficiencies at scale.
Introduction
High-Performance Computing (HPC) has traditionally been the domain of the Message Passing Interface (MPI) and C/C++, optimized for raw performance and direct hardware access. However, the explosion of scientific data has made the complexity of MPI a barrier for many researchers. Apache Spark, the leading framework in the cloud ecosystem, offers a user-friendly dataflow model and built-in fault tolerance. This paper investigates whether Spark can be effectively ported to supercomputers and how its performance compares to the gold-standard MPI/C implementations.
Methodology
The researchers developed a benchmarking pipeline emulating a typical scientific image analysis workflow, involving data loading, "map" transformations, and "reduce" aggregations. The benchmark was implemented in three variants:
- Traditional MPI/C: The baseline for peak HPC performance.
- PySpark (Python): Leveraging the Python data science ecosystem (e.g., NumPy).
- Spark (Scala): The native JVM-based implementation of Spark.
Testing was conducted on two distinct systems: Cooley, a mid-sized cluster, and Theta, a Cray XC40 supercomputer. Spark was deployed in "standalone mode," using custom scripts to interface with HPC job schedulers like Cobalt and SLURM. To test scaling limits, the benchmarks utilized synthetic data generation, scaling up to 65,536 cores on Theta.
Performance on Mid-Scale Systems (Cooley)
On the Cooley cluster, which represents a more modest scale of up to 1,152 cores, the performance gap between Spark and MPI was relatively narrow. Interestingly, PySpark outperformed the native Scala implementation in this environment.
The authors attribute PySpark's advantage to the efficiency of NumPy for linear algebra operations, which avoids some of the JVM overhead and serialization costs associated with the Scala version. At this scale, PySpark was approximately 1.5x slower than MPI, suggesting that for medium-scale tasks, Spark's ease of use may outweigh its performance penalty.
Large-Scale Challenges (Theta)
As the benchmarks scaled to the massive Theta system, the performance characteristics shifted dramatically. At 65,536 cores, both Spark implementations were roughly 30x slower than the MPI/C baseline.
Several key factors contributed to this degradation:
- The TCP/IP Bottleneck: Unlike MPI, which communicates directly with high-speed interconnects (Cray Aries), Spark relies on a TCP/IP stack. This introduces significant overhead in system calls and memory copies.
- The "Heartbeat" Problem: At extreme scales, Spark's internal health-check mechanisms (heartbeats) can overwhelm the network with hundreds of thousands of concurrent TCP connections, necessitating manual intervention to prevent system instability.
- Scaling Behavior: While MPI demonstrated near-ideal scaling, Spark's performance began to plateau or even degrade as node counts increased, as the time required to manage network connections began to exceed actual computation time.
Discussion and Future Work
Despite the performance "tax," Spark offers unique advantages for HPC. Its fault tolerance—achieved through lazy evaluation and lineage tracking—allows it to recover from node failures automatically, a feature MPI lacks. This makes Spark highly attractive for long-running jobs on large, aging systems where hardware failure is a statistical certainty.
Future improvements to narrow the performance gap include:
- Kernel Tuning: Optimizing Linux kernel parameters to better handle the massive TCP connection volume generated by Spark.
- I/O Optimization: Investigating Spark's interaction with parallel file systems like Lustre.
- Hybrid Workflows: Utilizing MPI for heavy computation while leveraging Spark for post-processing and data analysis.
Conclusion
Apache Spark is a promising tool for making supercomputers more accessible to the broader data science community. While it currently cannot match the raw speed of MPI/C at extreme scales, its portability and robust feature set make it a viable alternative for many scientific data analysis tasks, provided researchers account for the networking overhead inherent in its cloud-native design.
Summary updated