Spark clusters in Azure HDInsight. SparkCruise exposes a work-
load optimization platform that leverages massive cloud workloads
and provides a feedback loop to the Spark engine for improving
performance and reducing costs. We demonstrated an early ver-
sion of the SparkCruise system earlier [
28
]. Since then we have
added newer techniques for plan log collection, introduced a scal-
able telemetry pipeline that runs daily, explored data cleaning and
integration techniques to improve the quality of our common work-
load representation, analyzed production workloads to characterize
the Spark workloads in HDInsight, provided a notebook for cus-
tomers to derive insights from their own workloads, and pushed
one concrete feature for automatic computation reuse all the way to
production. We describe the overall system design and extensibility
of SparkCruise, the opportunities for compute reuse in production
Spark workloads, the deployment of SparkCruise in HDInsight,
and the experiences from our production journey.
Our key contributions can be summarized as follows:
•
We present the SparkCruise platform for adding workload-
driven feedback loop in Spark, and discuss how it transforms
Spark engine from optimizing one query at a time to opti-
mizing end to end workloads. (Section 3)
•
We describe a query plan telemetry pipeline for collecting
anonymized Spark SQL plans with low overheads and at
production scale. (Section 4)
•
We introduce a denormalized workload representation for
Spark that combines both the compile-time and run-time
characteristics of the workload and could be used for a va-
riety of optimization features. We discuss the data quality
challenges in creating this workload representation and show
cleaning techniques to overcome them. (Section 5)
•
We present detailed insights from production Spark work-
loads at Microsoft, including distributions of inputs, applica-
tions, queries, operators, cardinalities, selectivities, and plan
shapes such as width and height. (Section 6)
•
We describe a workload insights notebook that we have built
and released for customers in HDInsight to discover insights
from their own workloads. (Section 7)
•
Finally, we drill down into automatic computation reuse as a
concrete workload optimization in Spark that we have built
and released for customers in HDInsight. We discuss the
reuse mechanisms and various online and oine policies for
view selection and materialization. (Section 8)
2 SPARK BACKGROUND
The Spark data processing platform supports a variety of analytical
applications including batch or interactive analytics over structured
or unstructured data, streaming analytics over constantly arriving
data, graph analytics over linked data, iterative machine learning
algorithms, and the newer data science applications. Structured
data processing, in particular, has increasingly gained enterprise
level adoption in the last few years with several large companies
running their key ETL workloads using Spark. This has resulted
in several trends. First, Spark has become the most active Apache
project that is visited on GitHub [
18
], with a vibrant open source
community of 83 committers [
19
] and numerous meet-ups around
the world [
12
], Second, there is in-house Spark development at
several large enterprises such as LinkedIn [
24
], Facebook [
11
], and
IBM [
8
], and Third, there are managed Spark services from all major
cloud providers, including Amazon Web Services [
5
,
9
], Microsoft
Azure [6, 7, 26], and Google Cloud [10].
At Microsoft, Azure HDInsight allows customers to run popular
open source frameworks — including Apache Hadoop, Spark, Hive,
Kafka, and more [
26
]. Essentially, it abstracts the complexities in
setting up and maintaining the cluster, and providing a more man-
aged experience for customers to quickly get started with their
analytical tasks. For Spark, this means that users can leverage the
latest Spark distributions, easily congure their cluster for dierent
application needs, and monitor and tune the performance and costs.
As a result of this better Spark infrastructure experience, we nd
a large fraction of HDInsight customers running their recurring
ETL workloads. Others prominent use of HDInsight Spark is for
interactive notebooks that have become very popular for ad-hoc
analysis. Interestingly, workload optimization is relevant to both
these usage types: for saving total costs in ETL workloads and for
reducing the time to insights in interactive workloads.
Spark workloads are made up of applications, each of which
consist of one or more queries running in the Spark session. Multiple
applications can run in parallel on the same cluster. We focus on
Spark SQL queries, i.e, all analytics that compile down to Spark
dataframes and go through the Catalyst query optimizer, while
ignoring the programs written directly against the RDDs. This is
because declarative Spark SQL workloads are more amenable to
characterization and feedback in the query optimizer layer (without
aecting the user expectation on how the programs should be
executed, as with RDDs), not to mention they also form the majority
of our workloads.
In the remainder of the paper, we rst provide an overview of
SparkCruise, our workload optimization platform for Spark, before
describing each of its components and discussing the features we
have shipped in HDInsight.
3 SPARKCRUISE OVERVIEW
SparkCruise adds a workload-driven feedback loop to Spark to
instance optimize its performance for a given workload. Figure 1
shows the overall architecture. As mentioned before, we focus on
Spark SQL queries that run through the Catalyst query optimizer
and that users expect the system to optimize, as opposed to RDD
programs that are almost like physical execution plans handcrafted
by the users. There are four sets of components in Figure 1 that are
worth highlighting and we discuss them below.
First, SparkCruise provides an elaborate query plan telemetry
that captures Spark SQL query plans in a scalable manner. This
includes an additional plan log listener to collect plans in JSON
format, adding identiers called signatures at each node in the
query plan, anonymizing the plans from any personally identiable
information (PII), and collecting the resulting log in both structured
and semi-structured format with varying degree of retention. The
query plan telemetry is enabled simply via a conguration change
and once collected it could be used for a variety of further analysis
by both the service provider and well as the customer themselves.
Second, the workload collected above goes through a set of pre-
processing to generate a common workload representation that
3123
评论