Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Self Driving Database

Adrian Holfter edited this page Jun 8, 2018 · 3 revisions

Tuning Subsystem

The Tuning subsystem allows different aspects of the database to be tuned. The system can be extended to support concrete use cases by implementing the provided abstract classes.

Basic Ideas & How to extend for your use case

Tuning, performed by the Tuner class, takes place in three conceptual steps: evaluation, selection and execution.

  1. An Evaluator (implement by inheriting AbstractTuningEvaluator) analyzes the state of the system and proposes several TuningOptions. A TuningOption has a certain desirability (e.g. positive: speeds up system, negative: makes system slower), confidence and a cost (permanent usage of some budget, e.g. a memory budget). It can be accepted and rejected later on, and has a flag that indicates whether it is currently chosen, i.e. if it represents the current state of the system in that aspect. For instance: Having or not having a specific index on a column (the option) may speed up the system based on recent queries that used that column (desirability), and the index may or might not already exist (currently chosen). Accepting the option will create/keep the index, rejecting it will drop/not create the index.
  2. All TuningOptions are then transformed into an sorted list of TuningOperations. This is the job of the AbstractTuningSelector, with a GreedyTuningSelector being implemented and usable by default. The selector decides which options to accept and to reject (yielding a TuningOperation each) and orders these operations in such a way that the overall cost budget (e.g. memory budget) is not exceeded at any time when executing the operations in the given order.
  3. Finally, the TuningOperations are executed one after the other. Execution, as all other steps, adheres to a time budget, and thus might be cancelled at any time.

For your specific use case, you need to at least inherit from AbstractTuningEvaluator, TuningOption and TuningOperation for accepting and rejecting such a option.

Index Creation

The automatic creation and removal of indexes is implemented as an example: the IndexTuningEvaluator looks at the query cache and column statistics to determine which indexes could be created, and returns a list of IndexTuningOptions. These are selected by a GreedyTuningSelector which then, upon execution, creates or removes indexes. The tuning process adheres to a memory budget configurable in the Tuner.

Clone this wiki locally