Automatic Database Management System Tuning Through
Large-scale Machine Learning
Dana Van Aken Andrew Pavlo Geoffrey J. Gordon Bohan Zhang
Carnegie Mellon University Carnegie Mellon University Carnegie Mellon University Peking University
dvanaken@cs.cmu.edu pavlo@cs.cmu.edu ggordon@cs.cmu.edu bohan@pku.edu.cn
ABSTRACT
Database management system (DBMS) configuration tuning is an
essential aspect of any data-intensive application effort. But this
is historically a difficult task because DBMSs have hundreds of
configuration “knobs” that control everything in the system, such
as the amount of memory to use for caches and how often data
is written to storage. The problem with these knobs is that they
are not standardized (i.e., two DBMSs use a different name for the
same knob), not independent (i.e., changing one knob can impact
others), and not universal (i.e., what works for one application may
be sub-optimal for another). Worse, information about the effects
of the knobs typically comes only from (expensive) experience.
To overcome these challenges, we present an automated approach
that leverages past experience and collects new information to tune
DBMS configurations: we use a combination of supervised and un-
supervised machine learning methods to (1) select the most impact-
ful knobs, (2) map unseen database workloads to previous work-
loads from which we can transfer experience, and (3) recommend
knob settings. We implemented our techniques in a new tool called
OtterTune and tested it on three DBMSs. Our evaluation shows that
OtterTune recommends configurations that are as good as or better
than ones generated by existing tools or a human expert.
1. INTRODUCTION
The ability to collect, process, and analyze large amounts of data
is paramount for being able to extrapolate new knowledge in busi-
ness and scientific domains [35, 25]. DBMSs are the critical com-
ponent of data-intensive (“Big Data”) applications [46]. The per-
formance of these systems is often measured in metrics such as
throughput (e.g., how fast it can collect new data) and latency (e.g.,
how fast it can respond to a request).
Achieving good performance in DBMSs is non-trivial as they are
complex systems with many tunable options that control nearly all
aspects of their runtime operation [24]. Such configuration knobs
allow the database administrator (DBA) to control various aspects
of the DBMS’s runtime behavior. For example, they can set how
much memory the system allocates for data caching versus the
transaction log buffer. Modern DBMSs are notorious for having
Permission to make digital or hard copies of all or part of this work for personal or
classroom use is granted without fee provided that copies are not made or distributed
for profit or commercial advantage and that copies bear this notice and the full citation
on the first page. Copyrights for components of this work owned by others than the
author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or
republish, to post on servers or to redistribute to lists, requires prior specific permission
and/or a fee. Request permissions from permissions@acm.org.
SIGMOD’17, May 14 - 19, 2017, Chicago, IL, USA
© 2017 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ISBN 978-1-4503-4197-4/17/05. . . $15.00
DOI: http://dx.doi.org/10.1145/3035918.3064029
many configuration knobs [22, 47, 36]. Part of what makes DBMSs
so enigmatic is that their performance and scalability are highly de-
pendent on their configurations. Further exacerbating this problem
is that the default configurations of these knobs are notoriously bad.
As an example, the default MySQL configuration in 2016 assumes
that it is deployed on a machine that only has 160 MB of RAM [1].
Given this, many organizations resort to hiring expensive experts
to configure the system’s knobs for the expected workload. But as
databases and applications grow in both size and complexity, opti-
mizing a DBMS to meet the needs of an application has surpassed
the abilities of humans [11]. This is because the correct configura-
tion of a DBMS is highly dependent on a number of factors that are
beyond what humans can reason about.
Previous attempts at automatic DBMS configuration tools have
certain deficiencies that make them inadequate for general purpose
database applications. Many of these tuning tools were created
by vendors, and thus they only support that particular company’s
DBMS [22, 33, 37]. The small number of tuning tools that do sup-
port multiple DBMSs still require manual steps, such as having the
DBA (1) deploy a second copy of the database [24], (2) map depen-
dencies between knobs [49], or (3) guide the training process [58].
All of these tools also examine each DBMS deployment indepen-
dently and thus are unable to apply knowledge gained from previ-
ous tuning efforts. This is inefficient because each tuning effort can
take a long time and use a lot of resources.
In this paper, we present a technique to reuse training data gath-
ered from previous sessions to tune new DBMS deployments. The
crux of our approach is to train machine learning (ML) models
from measurements collected from these previous tunings, and use
the models to (1) select the most important knobs, (2) map previ-
ously unseen database workloads to known workloads, so that we
can transfer previous experience, and (3) recommend knob settings
that improve a target objective (e.g., latency, throughput). Reusing
past experience reduces the amount of time and resources it takes
to tune a DBMS for a new application. To evaluate our work, we
implemented our techniques using Google TensorFlow [50] and
Python’s scikit-learn [39] in a tuning tool, called OtterTune,
and performed experiments for two OLTP DBMSs (MySQL, Post-
gres) and one OLAP DBMS (Vector). Our results show that Ot-
terTune produces a DBMS configuration for these workloads that
achieves 58–94% lower latency compared to their default settings
or configurations generated by other tuning advisors. We also show
that OtterTune generates configurations in under 60 min that are
within 94% of ones created by expert DBAs.
The remainder of this paper is organized as follows. Sect. 2 be-
gins with a discussion of the challenges in database tuning. We then
provide an overview of our approach in Sect. 3, followed by a de-
scription of our techniques for collecting DBMS metrics in Sect. 4,
评论