  We investigate the performance of Apache Spark, a cluster computing
framework, for analyzing data from future LSST-like galaxy surveys. Apache
Spark attempts to address big data problems have hitherto proved successful in
the industry, but its use in the astronomical community still remains limited.
We show how to manage complex binary data structures handled in astrophysics
experiments such as binary tables stored in FITS files, within a distributed
environment. To this purpose, we first designed and implemented a Spark
connector to handle sets of arbitrarily large FITS files, called spark-fits.
The user interface is such that a simple file "drag-and-drop" to a cluster
gives full advantage of the framework. We demonstrate the very high scalability
of spark-fits using the LSST fast simulation tool, CoLoRe, and present the
methodologies for measuring and tuning the performance bottlenecks for the
workloads, scaling up to terabytes of FITS data on the Cloud@VirtualData,
located at Universit\'e Paris Sud. We also evaluate its performance on Cori, a
High-Performance Computing system located at NERSC, and widely used in the
scientific community.
