Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizer: Sysbench support #4173

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

poojam23
Copy link
Contributor

This PR is for commits related to changes required for sysbench support in the Rocksdb Config Optimizer.

This adds the ConfigOptimizer code, though testing the code is WIP.
It also adds some unit tests for the classes Log and DatabaseLog;
correspondingly fixes some issues in the 2 classes.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Changes per file:
db_benchmark_client.py - name of the LOG file
db_options_parser.py - not storing file_name, since update_options does
not update in the original Options file; removed some redundant
code; added code for testing (to be moved to unit tests later)
rule_parser.py - modified OptionCondition to always contain list of
options
db_timeseries_parser.py - added some checks for case when map keys
from the TimeSeriesCondition may not be available in the provided
data source
db_stats_fetcher.py - modified LogStatsParser to add statistic to
keys_ts map only when it is present in the LOG file; added code for
testing (to be moved to unit test later)

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
config_optimizer_example.py - changed the way the bench runner is being
initialized; also send it ODS arguments
db_benchmark_client.py - added OdsStatsFetcher object to data_sources
returned by run_experiment
db_config_optimizer.py - added code to output results
db_stats_fetcher.py - changed the way TimeSeriesCondition keys are
processed by LogStatsParser and OdsStatsFetcher
rule_parser.py - added code for more information in output of
rule_parser

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
config_optimizer_example: calling the new optimizer method, taking
stats_dump_period_sec, db_log_dir as command-line args
db_benchmark_client: logic for the LOG file name; removed timeout from
_run_command(); run_experiment() also returns the throughput obtained at
the end of the db_bench run
db_timeseries_parser: added support for the case when condition requires
evaluate_expression at each epoch instead of with only aggregated
values; fetch_aggregated_values() returns aggregated values of
statistics for a given entity, earlier it used to return the same for
all entities
db_config_optimizer: moved the code that applies suggestion from
improve_db_config to apply_action_on_value; added run_v2() and
improve_db_config_v2(): in this one rule is picked at a time, all its
suggestions are applied, then bench_runner.run_experiment(new_config)
called, if throughput improves, then use the new_data_sources returned
for checking for more triggered rules, else, backtrack to the previous
config and pick another rule to apply.
db_stats_fetcher: added a parser for the ods cli output; added some more
code for testing
rule_parser: remove the check for 'bursty' conditions in the Rule's
is_triggered() method; since now the evalutate_expression (without
aggregation_op) also returns a list of epoch where the expression
evaluates to true

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Changes per file:
config_optimizer_example- command-line args support for options that are
not supported by options.ini file, but can be given to bench_runner
db_benchmark_client- fixed the bugs in the location and name of the LOG
files; support for using the misc_options as db_bench command-line args;
some testing code
db_options_parser- method for finding diff between 2 option_configs;
support for misc_options; some testing code
rules.ini- support for misc_options
db_config_optimizer- per-method changes:
  * apply_action_on_value: handle cases when old_value is None
  * improve_db_config: modified to handle the case when a suggestion's
    option was not in the existing config
  * improve_db_config_v2: same as above
  * disambiguate_guidelines: handle the case of disambiguation
    when a guideline's option is not in the existing config
  * run_v2: shifted code for picking a rule and getting
    updated_config to new method: apply_suggestions()
  * apply_suggestions: new method to pick new rule, and get
    updated_config
  * get_backtrack_config: new method to get config to update
    options to so that the latest changes applied, are reversed

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Changes per file:
config_optimizer_example - removed the db_log_dir option, since making
changes to it might cause DBBenchRunner to crash when it tries to use it
as a command-line arg
db_options_parser - added a method to return all the options in the
DatabaseOptions object
db_benchmark_client - added method to fetch default Rocksdb options used
by db_bench in case the default OPTIONS file is not provided; shifted
the db_bench output parsing code to a separate method; created a build
the appropriate command for db_bench; added some testing code

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
changes per file:
db_stats_fetcher: add the DatabasePerfContext class; some code for
testing
db_benchmark_client: modified DBBenchRunner to parse its own output and
return a DatabasePerfContext too; changed the return type of
run_experiment; added some code for testing
rule_parser: changes in trigger_conditions to take into account the
changes in the data_sources object returned by DBBenchRunner
db_timeseries_parser: initialise stats_freq_sec in TimeSeriesData
constructor

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Changes per file:
config_optimizer_example: command line args ldb, base_db_path
db_benchmark_client: run_experiment takes db_path
db_config_optimizer: bootstraps database before each experiment run
db_timeseries_parser: performing a common (bursty/evaluate_expression)
check for entities with all required stats (per condition) in
check_and_trigger_conditions

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Changes in files:
config_optimizer_example: removed the ldb argument
db_benchmark_client: handle the compression option as a command-line
arg; bootstrap the database according to the current options
db_config_optimizer: don't set up the database with default options;
leave it to the benchrunner to do the same on its own with the
applicable options
rules.ini: added some more rules and corrected some

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Changes per file:
db_benchmark_client: add staticmethod is_metric_better() to BenchRunner;
implement the same in DBBenchRunner to compare throughput
db_config_optimizer: use bench_runner.is_metric_better() method to
decide whether to backtrack or not in the optimization loop

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
This class parses a my-*.cnf file and can update the Rocksdb options
present in the config, provided by the DatabaseOptions object.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired.

Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants