clickhouse-benchmark
Connects to a ClickHouse server and repeatedly sends specified queries.
Syntax
or
or
If you want to send a set of queries, create a text file and place each query on the individual string in this file. For example:
Then pass this file to a standard input of clickhouse-benchmark:
Command-line options
--query=QUERY— Query to execute. If this parameter is not passed,clickhouse-benchmarkwill read queries from standard input.--query_id=ID— Query Id.--query_id_prefix=ID_PREFIX— Query Id Prefix.-c N,--concurrency=N— Number of queries thatclickhouse-benchmarksends simultaneously. Default value: 1.-C N,--max_concurrency=N— Gradually increases number of parallel queries up to specified value, making one report for every concurrency level.--precise— Enables precise per-interval reporting with weighted metrics.-d N,--delay=N— Interval in seconds between intermediate reports (to disable reports set 0). Default value: 1.-h HOST,--host=HOST— Server host. Default value:localhost. For the comparison mode you can use multiple-hkeys.-i N,--iterations=N— Total number of queries. Default value: 0 (repeat forever).-r,--randomize— Random order of queries execution if there is more than one input query.-s,--secure— UsingTLSconnection.-t N,--timelimit=N— Time limit in seconds.clickhouse-benchmarkstops sending queries when the specified time limit is reached. Default value: 0 (time limit disabled).--port=N— Server port. Default value: 9000. For the comparison mode you can use multiple--portkeys.--confidence=N— Level of confidence for T-test. Possible values: 0 (80%), 1 (90%), 2 (95%), 3 (98%), 4 (99%), 5 (99.5%). Default value: 5. In the comparison modeclickhouse-benchmarkperforms the Independent two-sample Student's t-test to determine whether the two distributions aren't different with the selected level of confidence.--cumulative— Printing cumulative data instead of data per interval.--database=DATABASE_NAME— ClickHouse database name. Default value:default.--user=USERNAME— ClickHouse user name. Default value:default.--password=PSWD— ClickHouse user password. Default value: empty string.--stacktrace— Stack traces output. When the key is set,clickhouse-bencmarkoutputs stack traces of exceptions.--stage=WORD— Query processing stage at server. ClickHouse stops query processing and returns an answer toclickhouse-benchmarkat the specified stage. Possible values:complete,fetch_columns,with_mergeable_state. Default value:complete.--roundrobin— Instead of comparing queries for different--host/--portjust pick one random--host/--portfor every query and send query to it.--reconnect=N— Control reconnection behaviour. Possible values 0 (never reconnect), 1 (reconnect for every query), or N (reconnect after every N queries). Default value: 0.--max-consecutive-errors=N— Number of allowed consecutive errors. Default value: 0.--ignore-error,--continue_on_errors— Continue testing even if queries failed.--client-side-time— Display the time including network communication instead of server-side time; Note that for server versions before 22.8 we always display client-side time.--proto-caps— Enable/disable chunking in data transfer. choices (can be comma-separated):chunked_optional,notchunked,notchunked_optional,send_chunked,send_chunked_optional,send_notchunked,send_notchunked_optional,recv_chunked,recv_chunked_optional,recv_notchunked,recv_notchunked_optional. Default value:notchunked.--help— Shows the help message.--verbose— Increase help message verbosity.
If you want to apply some settings for queries, pass them as a key --<session setting name>= SETTING_VALUE. For example, --max_memory_usage=1048576.
Environment variable options
The user name, password and host can be set via environment variables CLICKHOUSE_USER, CLICKHOUSE_PASSWORD and CLICKHOUSE_HOST.
Command line arguments --user, --password or --host take precedence over environment variables.
Output
By default, clickhouse-benchmark reports for each --delay interval.
Example of the report:
In the report you can find:
-
Number of queries in the
Queries executed:field. -
Status string containing (in order):
- Endpoint of ClickHouse server.
- Number of processed queries.
- QPS: How many queries the server performed per second during a period specified in the
--delayargument. - RPS: How many rows the server reads per second during a period specified in the
--delayargument. - MiB/s: How many mebibytes the server reads per second during a period specified in the
--delayargument. - result RPS: How many rows placed by the server to the result of a query per second during a period specified in the
--delayargument. - result MiB/s. How many mebibytes placed by the server to the result of a query per second during a period specified in the
--delayargument.
-
Percentiles of queries execution time.
Comparison Mode
clickhouse-benchmark can compare performances for two running ClickHouse servers.
To use the comparison mode, specify endpoints of both servers by two pairs of --host, --port keys. Keys matched together by position in arguments list, the first --host is matched with the first --port and so on. clickhouse-benchmark establishes connections to both servers, then sends queries. Each query addressed to a randomly selected server. The results are shown in a table.