Abstract
Scientific analyses commonly compose multiple single-process programs into a dataflow. An end-to-end dataflow of single-process programs is known as a many-task application. Typically, tools from the HPC software stack are used to parallelize these analyses. In this work, we investigate an alternate approach that uses Apache Spark -- a modern big data platform -- to parallelize many-task applications. We present Kira, a flexible and distributed astronomy image processing toolkit using Apache Spark. We then use the Kira toolkit to implement a Source Extractor application for astronomy images, called Kira SE. With Kira SE as the use case, we study the programming flexibility, dataflow richness, scheduling capacity and performance of Apache Spark running on the EC2 cloud. By exploiting data locality, Kira SE achieves a 2.5x speedup over an equivalent C program when analyzing a 1TB dataset using 512 cores on the Amazon EC2 cloud. Furthermore, we show that by leveraging software originally designed for big data infrastructure, Kira SE achieves competitive performance to the C implementation running on the NERSC Edison supercomputer. Our experience with Kira indicates that emerging Big Data platforms such as Apache Spark are a performant alternative for many-task scientific applications.
Introduction
Modern astronomy is entering an era of unprecedented data volume. Sky surveys like the Large Synoptic Survey Telescope (LSST) are projected to generate terabytes of data every night, creating a significant processing challenge for traditional scientific computing infrastructures. Historically, researchers have utilized High-Performance Computing (HPC) tools such as MPI or HTCondor to manage "many-task" applications—workflows consisting of numerous independent, single-process programs. However, these traditional tools often struggle with rigid programming models, limited fault tolerance, and inefficient data handling when scaled to modern "Big Data" levels.
This paper explores whether Apache Spark, a leading industry-standard big data engine, can serve as a more flexible and performant alternative for scientific many-task applications.
The Kira Framework
To test this hypothesis, we developed Kira, a distributed astronomy toolkit built on Apache Spark. Kira bridges the gap between high-level data orchestration and low-level scientific performance through several key design choices:
- Hybrid Library Model: Rather than rewriting established astronomical algorithms, Kira leverages the SEP library (a C-based implementation of the standard SExtractor). By using the Java Native Interface (JNI), Kira maintains the execution speed of optimized C code while benefiting from Spark’s distributed scheduling.
- Data Locality via HDFS: Traditional HPC systems often rely on a central shared file system, which becomes a network bottleneck at scale. Kira utilizes the Hadoop Distributed File System (HDFS), allowing Spark to schedule computations on the same nodes where the data resides.
- Optimized Scheduling: We found that Spark’s default "delay scheduling" was counterproductive for the relatively small file sizes (~6MB) typical in astronomy. By tuning these parameters, we eliminated unnecessary idle time, ensuring high throughput.
Performance and Scalability
We evaluated Kira SE using datasets from the Sloan Digital Sky Survey (SDSS), ranging from a 65GB subset (DR2) to a full 1TB dataset (DR7).
Our results demonstrate that while traditional C implementations may have lower overhead at small scales (1-8 cores), Kira SE scales much more effectively as the cluster size increases. On the 1TB dataset using 512 cores on Amazon EC2, Kira SE achieved a 2.5x speedup over the equivalent C implementation running on a standard shared filesystem.
The primary driver of this performance gain is data locality. As shown in the following figure, the locality hit ratio for the C implementation drops precipitously as the number of cores increases, due to the limitations of the shared file system (GlusterFS). In contrast, Kira SE maintains a locality hit ratio near 100% across all scales.
Furthermore, Kira SE running on commodity Amazon EC2 instances proved competitive with the same code running on NERSC Edison, a world-class supercomputer, highlighting the potential of cloud-based big data platforms for high-end science.
Conclusion
Kira demonstrates that modern big data platforms like Apache Spark are not only viable but often superior for many-task scientific applications. By prioritizing data locality and providing built-in fault tolerance through lineage tracking, Spark addresses many of the bottlenecks inherent in traditional HPC workflows. Future work will focus on further optimizing I/O through in-memory file systems and expanding the toolkit to support more complex astronomical pipelines, including image co-addition and reprojection.
Summary updated