0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/ee/benchmarks/README.md
Karl-Aksel Puulmann 437b2982cd
Benchmarking suite for ClickHouse queries (#6187)
* Add asv code

* Get a benchmark running

* better output folder

* Move benchmark file

* Cleanup of config

* Run a query and benchmark

* Skip benchmarks for isort

* Set up materialized columns before test

* Better skipping logic

* Add first proper benchmark, add some documentation

* Person property filtering

* Add new workflow

* Show stderr in test run

* Continue debugging actions

* Try to save benchmark results to separate repo

* Output to main directory

* Scheduling

* Remove if temporarily

* Int for ms

* Comment on the PR

* Collapsible section

* Update README

* Clarification

* Remove h3

* Remove pyproject.toml, .gitignore changes that are unneeded
2021-10-01 15:20:58 +03:00

2.0 KiB

Clickhouse query benchmarks

This is the benchmark suite for PostHog clickhouse queries. It tracks performance improvements to clickhouse queries over time.

The benchmarks are run using airspeed velocity.

To get stable results over time, a stable clickhouse node which has been pre-filled with data is used to run against.

Historical benchmark results can be found in https://github.com/PostHog/benchmark-results.

FAQ

Benchmarking your PRs

Benchmarks run every day against master branch.

If your branch contains significant changes to query performance, add performance label to your PR.

An action will then run and comment on the benchmarks on your PR.

Installation (local)

These benchmarks are run using airspeed velocity so, you need to have asv installed,

pip install asv

Running the benchmarks locally

These benchmarks are mostly run in CI for:

  • master branch
  • PRs labeled with performance

To run the all the benchmarks locally, get access to the clickhouse node and:

# Set up machine
asv machine --machine ci-benchmarks --config ee/benchmarks/asv.conf.json
# Replace X with appropriate credentials
CLICKHOUSE_HOST=X CLICKHOUSE_USER=X CLICKHOUSE_PASSWORD=X CLICKHOUSE_DATABASE=posthog asv run --config ee/benchmarks/asv.conf.json

See asv documentation for additional information.

Adding new benchmarks

Edit the benchmarks.py file as needed. Use @benchmark_clickhouse decorator to select tests to run

Backfilling benchmarks

  • Clone https://github.com/PostHog/benchmark-results locally under ee/benchmarks/results
  • Run something like CLICKHOUSE_HOST=X CLICKHOUSE_USER=X CLICKHOUSE_PASSWORD=X CLICKHOUSE_DATABASE=posthog asv run --config ee/benchmarks/asv.conf.json --date-period 4d master~500..
  • Run asv publish and commit the changes to benchmark-results repo

If you have questions, use benchmark.yml github action as a guide.