Skip to content

Conversation

@swilly22
Copy link
Contributor

@swilly22 swilly22 commented Jan 31, 2021

Goals

The RedisGraph automated benchmark definitions provide a framework for evaluating and comparing feature branches and catching regressions prior letting them into the master branch.

Benchmark definition

Each benchmark requires a benchmark definition yaml file to present on the current directory.
A benchmark definition will then consist of:

  • optional db configuration (dbconfig) with the proper dataset definition. If no db config is passed then no dataset is loaded during the system setup.

  • mandatory client configuration (clientconfig) specifing the parameters to pass to the redisgraph-benchmark-go tool.

  • mandatory queries definition (queries) specifying which queries, and at what ratio the benchmark should issue.

  • optional ci/remote definition (ci), with the proper terraform deployment configurations definition.

  • optional KPIs definition (kpis), specifying the target upper or lower bounds for each relevant performance metric. If specified the KPIs definitions constraints the tests passing/failing.

  • optional metric exporters definition ( exporter: currently only redistimeseries), specifying which metrics to parse after each benchmark run and push to remote stores.

Sample benchmark definition:

name: "UPDATE-BASELINE"
dbconfig:
  - dataset: "datasets/single_node.rdb"
clientconfig:
  - graph: "g"
  - rps: 0
  - clients: 32
  - threads: 4
  - connections: 32
  - requests: 1000000
queries:
  - { q: "MATCH (n) SET n.v = 1", ratio: 1 }
kpis: 
  - eq: { $.Totals.Total.Errors: 0 }
  - le: { $.OverallClientQuantiles.Total.q50: 1.5 }
  - ge: { $.OverallQueryRates.Total: 20000 }
remote:
  - setup: redisgraph-r5
  - type: oss-standalone
exporter:
  redistimeseries:
    timemetric: "$.StartTime"
    metrics:
      - "$.OverallClientQuantiles.Total.q50"
      - "$.OverallClientQuantiles.Total.q95"
      - "$.OverallClientQuantiles.Total.q99"
      - "$.OverallGraphInternalQuantiles.Total.q50"
      - "$.OverallGraphInternalQuantiles.Total.q95"
      - "$.OverallGraphInternalQuantiles.Total.q99"
      - "$.OverallQueryRates.Total"

Running benchmarks

The benchmark automation currently allows running benchmarks in various environments:

  • completely locally, if the framework is supported on the local system.

  • on AWS, distributing the tasks to multiple EC2 instances as defined on each benchmark specification. To run a benchmark on AWS you additionally need to have a configured AWS account. The application is using the boto3 Python package to exchange files through S3 and create EC2 instances. Triggering of this type of benchmarks can be done from a local machine or via CI on each push to the repo. The results visualization utilities and credentials should have been provide to each team member.

Run benchmarks locally

To run a benchmark locally call the local-runner.py from within the benchmarks folder, or use the benchmark Makefile rule from within the project root folder. make benchmark-local.
Some considerations:

  • By default all benchmark definitions will be run.
  • By default the local-runner script assumes you have a compiled redisgraph.so module within src folder.
  • Each benchmark definition will spawn a standalone redis-server and make usage of redisgraph-benchmark-go to run the query variations.
  • After each benchmark the defined KPIs limits are checked and will influence the exit code of the runner script.
  • At the end of each benchmark an output json file is stored with this benchamrks folder and will be named like <start time>-<git branch>-<test name>.json

For the complete list of supported local arguments, run:

python3 local-runner.py --help

$ python3 local-runner.py --help
usage: local-runner.py [-h] [--module_path MODULE_PATH] [--redisgraph_port REDISGRAPH_PORT]

RedisGraph remote performance tester.

optional arguments:
  -h, --help            show this help message and exit
  --module_path MODULE_PATH
  --redisgraph_port REDISGRAPH_PORT

Run benchmarks remotely on steady stable VMs with sustained performance

To run a benchmark remotely call the remote-runner.py.
Some considerations:

  • To run a benchmark on AWS you additionally need to have a configured AWS account. You can easily configure it by having the AWS_ACCESS_KEY_ID, AWS_DEFAULT_REGION, AWS_SECRET_ACCESS_KEY variables set.
  • You are required to have EC2 instances private key used to connect to the created EC2 instances set via the EC2_PRIVATE_PEM environment variable.
  • The git sha, git actor, git org, git repo, and git branch information are required to properly deploy the required EC2 instances. By default that information will be automatically retrieved and can be override by passing the corresponding arguments.
  • Apart from relying on a configured AWS account, the remote benchmarks require terraform to be installed on your local system. Within ./remote/install_deps.sh you find automation to easily install terraform on linux systems.
  • Optionally, at the end of each remote benchmark you push the results json file to the ci.benchmarks.redislabs S3 bucket. The pushed results will have a public read ACL.
  • Optionally, at the end of each remote benchmark you can chose the export the key metrics of the benchmark definition to a remote storage like RedisTimeSeries. To do so, you will need the following env variables defined (PERFORMANCE_RTS_AUTH, PERFORMANCE_RTS_HOST, PERFORMANCE_RTS_PORT) or to pass the corresponding arguments.
  • By default all benchmark definitions will be run.
  • By default the remote-runner script assumes you have a compiled redisgraph.so module within src folder.
  • Each benchmark definition will spawn one or multiple EC2 instances as defined on each benchmark specification
    a standalone redis-server, copy the dataset and module files to the DB VM and make usage of redisgraph-benchmark-go to run the query variations.
  • After each benchmark the defined KPIs limits are checked and will influence the exit code of the runner script. Even if we fail a benchmark variation, all other benchmark definitions are run.
  • At the end of each benchmark an output json file is stored with this benchmarks folder and will be named like <start time>-<deployment type>-<git org>-<git repo>-<git branch>-<test name>-<git sha>.json
  • In the case of a uncaught exception after we've deployed the environment the benchamrk script will always try to teardown the created environment.

For the complete list of supported remote run arguments, run:

python3 remote-runner.py --help

$ python3 remote-runner.py --help
usage: remote-runner.py [-h] [--github_actor GITHUB_ACTOR] [--github_repo GITHUB_REPO] [--github_org GITHUB_ORG] [--github_sha GITHUB_SHA] [--github_branch GITHUB_BRANCH]
                        [--triggering_env TRIGGERING_ENV] [--terraform_bin_path TERRAFORM_BIN_PATH] [--module_path MODULE_PATH] [--setup_name_sufix SETUP_NAME_SUFIX] [--s3_bucket_name S3_BUCKET_NAME]
                        [--upload_results_s3] [--redistimesies_host REDISTIMESIES_HOST] [--redistimesies_port REDISTIMESIES_PORT] [--redistimesies_pass REDISTIMESIES_PASS]
                        [--push_results_redistimeseries] [--skip-env-vars-verify]

RedisGraph remote performance tester.

optional arguments:
  -h, --help            show this help message and exit
  --github_actor GITHUB_ACTOR
  --github_repo GITHUB_REPO
  --github_org GITHUB_ORG
  --github_sha GITHUB_SHA
  --github_branch GITHUB_BRANCH
  --triggering_env TRIGGERING_ENV
  --terraform_bin_path TERRAFORM_BIN_PATH
  --module_path MODULE_PATH
  --setup_name_sufix SETUP_NAME_SUFIX
  --s3_bucket_name S3_BUCKET_NAME
                        S3 bucket name. (default: ci.benchmarks.redislabs)
  --upload_results_s3   uploads the result files and configuration file to public ci.benchmarks.redislabs bucket. Proper credentials are required (default: False)
  --redistimesies_host REDISTIMESIES_HOST
  --redistimesies_port REDISTIMESIES_PORT
  --redistimesies_pass REDISTIMESIES_PASS
  --push_results_redistimeseries
                        uploads the results to RedisTimeSeries. Proper credentials are required (default: False)
  --skip-env-vars-verify
                        skip environment variables check (default: False)

Locally comparing two distinct runs

TBD

@swilly22 swilly22 self-assigned this Jan 31, 2021
@swilly22
Copy link
Contributor Author

swilly22 commented Feb 4, 2021

Is it possible to run the benchmarks locally?

@swilly22
Copy link
Contributor Author

swilly22 commented Feb 4, 2021

@filipecosta90 shouldn't this infrastructure reside in its own repository and we'll fetch it with pip ?

@filipecosta90
Copy link
Collaborator

Is it possible to run the benchmarks locally?

Not yet, but yes, we need it working as expected prior merging the PR. Working on the remote and as soon all ok in remote will work on the local logic.

@filipecosta90 shouldn't this infrastructure reside in its own repository and we'll fetch it with pip ?

We can have infrastructure reside on https://github.com/RedisLabsModules/testing-infrastructure . After we have all working here will move the terraform parts to there :)

@filipecosta90 filipecosta90 changed the title benchmark template Added RedisGraph CI benchmark automation to run local benchmarks, trigger locally AWS benchmarks, or trigger from CI AWS benchmarks. Feb 8, 2021
@filipecosta90 filipecosta90 changed the title Added RedisGraph CI benchmark automation to run local benchmarks, trigger locally AWS benchmarks, or trigger from CI AWS benchmarks. Added benchmark automation to run local benchmarks, trigger locally AWS benchmarks, or trigger from CI AWS benchmarks. Feb 8, 2021
@filipecosta90 filipecosta90 changed the title Added benchmark automation to run local benchmarks, trigger locally AWS benchmarks, or trigger from CI AWS benchmarks. RedisGraph benchmark automation Feb 9, 2021
@filipecosta90
Copy link
Collaborator

  • change tests/benchmarks/template to the new version of specification
  • add make benchmark <test name> or make benchmark BENCHMARK=<test name>

…HMARH=<benchmark name>. Updated benchmark template
@filipecosta90
Copy link
Collaborator

* change tests/benchmarks/template to the new version of specification

* add `make benchmark <test name>` or `make benchmark BENCHMARK=<test name>`

@swilly22 updated the PR based on our discussion.

@swilly22 swilly22 merged commit f6f1ab2 into master Feb 15, 2021
@swilly22 swilly22 deleted the benchmarks branch February 15, 2021 13:03
jeffreylovitz pushed a commit that referenced this pull request Mar 10, 2021
* Added local and remote benchmark definition and automation

* [fix] Fixes per PR review. Added option to specify benchmark via BENCHMARH=<benchmark name>. Updated benchmark template

Co-authored-by: filipecosta90 <filipecosta.90@gmail.com>
(cherry picked from commit f6f1ab2)
swilly22 added a commit that referenced this pull request Mar 15, 2021
* RedisGraph benchmark automation  (#1557)

* Added local and remote benchmark definition and automation

* [fix] Fixes per PR review. Added option to specify benchmark via BENCHMARH=<benchmark name>. Updated benchmark template

Co-authored-by: filipecosta90 <filipecosta.90@gmail.com>
(cherry picked from commit f6f1ab2)

* Updated benchmark UPDATE-BASELINE to be less restrictive in the latency KPI (#1577)

Given we're still experimenting with the benchmarks CI KPI validation, this PR increases the `OverallClientLatencies.Total.q50` to be lower than 2.0 ( before was 1.5 ) so that we can collect further data and adjust afterwards...

(cherry picked from commit 611a0f0)

* * log redisgraph version (#1567)

When pulling container image tagged as `latest` or `edge` I sometimes
don't know which version I'm running, and it would be much faster to
find out if the information was displayed at startup. This patch logs
this information.

Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
(cherry picked from commit fe2e7ce)

* [add] Triggering nightly CI benchmarks; Early return on CI benchmarks for forked PRs (#1579)

(cherry picked from commit a529c1e)

* use PRIu64 to format uint64_t (#1581)

(cherry picked from commit c0e00d5)

* [fix] Fixed missing github_actor on ci nightly benchmark automation (#1583)

(cherry picked from commit 8abad84)

* Fix idx assertion (#1580)

* Fix flawed assertion in index deletion logic

* Reduce KPI for updates_baseline benchmark

* Address PR comments

* Address PR comments

Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
(cherry picked from commit 6bad20a)

* Always report run-time errors as the sole reply (#1590)

* Always report run-time errors as the sole reply

* Update test_timeout.py

Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
(cherry picked from commit c9ba776)

* remove wrong assertion (#1591)

(cherry picked from commit 12ef8ac)

* Report 0 indices created on duplicate index creation (#1592)

(cherry picked from commit e00f2c8)

* Multi-platform build (#1587)

Multi-platform build

(cherry picked from commit 26ace7a)

* Multi-platform build, take 2 (#1598)

(cherry picked from commit acde693)

* Moved common benchmark automation code to redisbench-admin package. Improved benchmark specification file (#1597)

(cherry picked from commit ebea927)

* Added readies submodule (#1600)

* Added readies submodule

* fixes 1

(cherry picked from commit efbfeaf)

* Dockerfle: fixed artifacts copy (#1601)

(cherry picked from commit f722f2d)

* CircleCI: fixed version release (#1602)

(cherry picked from commit 9f218d6)

* CircleCI: release-related fix (#1604)

(cherry picked from commit 15cf291)

* remove redundent include (#1606)

(cherry picked from commit 7ea1c43)

* Threaded bulk insert (#1596)

* Update the bulk updater to execute on a thread

* Bulk loader endpoint locks for minimal time

* TODOs

* Use a separate thread pool for bulk operations

* Update test_thread_pools.cpp

* refactor bulk-insert

* Fix PR problems

* count number of pings during bulk-insert, only create graph context on BEGIN token

Co-authored-by: swilly22 <roi@redislabs.com>
Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
(cherry picked from commit 2d43f9d)

* Use system gcc in Ubuntu 16 (#1615)

(cherry picked from commit 0c10130)

* wrongly assumed add op had only 2 operands (#1618)

(cherry picked from commit 6b06095)

* Updated benchmark requirements version (#1616)

* Updated benchmark requirements version

* Update requirements.txt

(cherry picked from commit db080d4)

* Runtime timeouts (#1610)

* Add run-time configuration for default query timeouts

* Timeout for write queries that haven't committed changes

* define TIMEOUT_NO_TIMEOUT

* Refactor timeout logic

* Address PR comments

* Do not use timeouts for write queries

Co-authored-by: swilly22 <roi@redislabs.com>
Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
(cherry picked from commit 964b268)

* Fix typo in assertion

* bump version to 2.2.16

Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
Co-authored-by: filipe oliveira <filipecosta.90@gmail.com>
Co-authored-by: bc² <odanoburu@users.noreply.github.com>
Co-authored-by: Rafi Einstein <raffapen@outlook.com>
pnxguide pushed a commit to CMU-SPEED/RedisGraph that referenced this pull request Mar 22, 2023
* Added local and remote benchmark definition and automation

* [fix] Fixes per PR review. Added option to specify benchmark via BENCHMARH=<benchmark name>. Updated benchmark template

Co-authored-by: filipecosta90 <filipecosta.90@gmail.com>
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.

3 participants