|
| 1 | +# Conducting load testing |
| 2 | + |
| 3 | +{{ ydb-short-name }} CLI has a built-in toolkit for performing load testing using several standard benchmarks: |
| 4 | + |
| 5 | +| Benchmark | Reference | |
| 6 | +|--------------------------------------|----------------------------------------------------------| |
| 7 | +| [TPC-H](https://tpc.org/tpch/) | [tpch](../../reference/ydb-cli/workload-tpch.md) | |
| 8 | +| [TPC-DS](https://tpc.org/tpcds/) | [tpcds](../../reference/ydb-cli/workload-tpcds.md) | |
| 9 | +| [ClickBench](https://benchmark.clickhouse.com/) | [clickbench](../../reference/ydb-cli/workload-click-bench.md) | |
| 10 | + |
| 11 | +They all function similarly. For a detailed description of each, refer to the relevant reference via the links above. All commands for working with benchmarks are organized into corresponding groups, and the database path is specified in the same way for all commands: |
| 12 | + |
| 13 | +```bash |
| 14 | +{{ ydb-cli }} workload clickbench --path path/in/database ... |
| 15 | +{{ ydb-cli }} workload tpch --path path/in/database ... |
| 16 | +{{ ydb-cli }} workload tpcds --path path/in/database ... |
| 17 | +``` |
| 18 | + |
| 19 | +Load testing can be divided into 3 stages: |
| 20 | + |
| 21 | +1. [Data preparation](#data-preparation) |
| 22 | +1. [Testing](#testing) |
| 23 | +1. [Cleanup](#cleanup) |
| 24 | + |
| 25 | +## Data preparation {#data-preparation} |
| 26 | + |
| 27 | +It consists of two steps: initializing tables and filling them with data. |
| 28 | + |
| 29 | +### Initialization |
| 30 | + |
| 31 | +Initialization is performed by the `init` command: |
| 32 | + |
| 33 | +```bash |
| 34 | +{{ ydb-cli }} workload clickbench --path clickbench/hits init --store=column |
| 35 | +{{ ydb-cli }} workload tpch --path tpch/s1 init --store=column |
| 36 | +{{ ydb-cli }} workload tpcds --path tpcds/s1 init --store=column |
| 37 | +``` |
| 38 | + |
| 39 | +At this stage, you can configure the tables to be created: |
| 40 | + |
| 41 | +* Select the type of tables to be used: row, column, external, etc. (parameter `--store`); |
| 42 | +* Select the types of columns to be used: some data types from the original benchmarks can be represented by multiple {{ ydb-short-name }} data types. In such cases, it is possible to select a specific one with `--string`, `--datetime`, and `--float-mode` parameters. |
| 43 | + |
| 44 | +You can also specify that tables should be deleted before creation if they already exist using the `--clear` parameter. |
| 45 | + |
| 46 | + |
| 47 | +For more details, see the description of the commands for each benchmark: |
| 48 | + |
| 49 | +* [clickbench init](../../reference/ydb-cli/workload-click-bench.md#init) |
| 50 | +* [tpch init](../../reference/ydb-cli/workload-tpch.md#init) |
| 51 | +* [tpcds init](../../reference/ydb-cli/workload-tpcds.md#init) |
| 52 | + |
| 53 | +### Data filling |
| 54 | + |
| 55 | +Filling with data is performed using the `import` command. This command is specific to each benchmark, and its behavior depends on the subcommands. However, there are also parameters common to all benchmarks. |
| 56 | + |
| 57 | +For a detailed description, see the relevant reference sections: |
| 58 | + |
| 59 | +* [clickbench import](../../reference/ydb-cli/workload-click-bench.md#load) |
| 60 | +* [tpch import](../../reference/ydb-cli/workload-tpch.md#load) |
| 61 | +* [tpcds import](../../reference/ydb-cli/workload-tpcds.md#load) |
| 62 | + |
| 63 | +Examples: |
| 64 | + |
| 65 | +```bash |
| 66 | +{{ ydb-cli }} workload clickbench --path clickbench/hits import files --input hits.csv.gz |
| 67 | +{{ ydb-cli }} workload tpch --path tpch/s1 import generator --scale 1 |
| 68 | +{{ ydb-cli }} workload tpcds --path tpcds/s1 import generator --scale 1 |
| 69 | +``` |
| 70 | + |
| 71 | +## Testing {#testing} |
| 72 | + |
| 73 | +The performance testing is performed using the `run` command. Its behavior is mostly the same across different benchmarks, though some differences do exist. |
| 74 | + |
| 75 | +Examples: |
| 76 | + |
| 77 | +```bash |
| 78 | +{{ ydb-cli }} workload clickbench --path clickbench/hits run --include 1-5,8 |
| 79 | +{{ ydb-cli }} workload tpch --path tpch/s1 run --exсlude 3,4 --iterations 3 |
| 80 | +{{ ydb-cli }} workload tpcds --path tpcds/s1 run --plan ~/query_plan --include 2 --iterations 5 |
| 81 | +``` |
| 82 | + |
| 83 | +The command allows you to select queries for execution, generate various types of reports, collect execution statistics, and more. |
| 84 | + |
| 85 | +For a detailed description, see the relevant reference sections: |
| 86 | + |
| 87 | +* [clickbench run](../../reference/ydb-cli/workload-click-bench.md#run) |
| 88 | +* [tpch run](../../reference/ydb-cli/workload-tpch.md#run) |
| 89 | +* [tpcds run](../../reference/ydb-cli/workload-tpcds.md#run) |
| 90 | + |
| 91 | +## Cleanup {#cleanup} |
| 92 | + |
| 93 | +After all necessary testing has been completed, the benchmark's data can be removed from the database using the `clean` command: |
| 94 | + |
| 95 | +```bash |
| 96 | +{{ ydb-cli }} workload clickbench --path clickbench/hits clean |
| 97 | +{{ ydb-cli }} workload tpch --path tpch/s1 clean |
| 98 | +{{ ydb-cli }} workload tpcds --path tpcds/s1 clean |
| 99 | +``` |
| 100 | + |
| 101 | +For a detailed description, see the corresponding sections: |
| 102 | + |
| 103 | +* [clickbench clean](../../reference/ydb-cli/workload-click-bench.md#cleanup) |
| 104 | +* [tpch clean](../../reference/ydb-cli/workload-tpch.md#cleanup) |
| 105 | +* [tpcds clean](../../reference/ydb-cli/workload-tpcds.md#cleanup) |
0 commit comments