-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(query): improve SELECTs performance (#169)
* Improve performance of `RowCursor::next()`. * Add `RowCursor::{decoded_bytes,received_bytes}` methods.
- Loading branch information
Showing
22 changed files
with
569 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Benchmarks | ||
|
||
All cases are run with `cargo bench --bench <case>`. | ||
|
||
## With a mocked server | ||
|
||
These benchmarks are run against a mocked server, which is a simple HTTP server that responds with a fixed response. This is useful to measure the overhead of the client itself: | ||
* `select` checks throughput of `Client::query()`. | ||
* `insert` checks throughput of `Client::insert()` and `Client::inserter()` (if the `inserter` features is enabled). | ||
|
||
### How to collect perf data | ||
|
||
The crate's code runs on the thread with the name `testee`: | ||
```bash | ||
cargo bench --bench <name> & | ||
perf record -p `ps -AT | grep testee | awk '{print $2}'` --call-graph dwarf,65528 --freq 5000 -g -- sleep 5 | ||
perf script > perf.script | ||
``` | ||
|
||
Then upload the `perf.script` file to [Firefox Profiler](https://profiler.firefox.com). | ||
|
||
## With a running ClickHouse server | ||
|
||
These benchmarks are run against a real ClickHouse server, so it must be started: | ||
```bash | ||
docker run -d -p 8123:8123 -p 9000:9000 --name ch clickhouse/clickhouse-server | ||
|
||
cargo bench --bench <case> | ||
``` | ||
|
||
Cases: | ||
* `select_numbers` measures time of running a big SELECT query to the `system.numbers_mt` table. | ||
|
||
### How to collect perf data | ||
|
||
```bash | ||
cargo bench --bench <name> & | ||
perf record -p `ps -AT | grep <name> | awk '{print $2}'` --call-graph dwarf,65528 --freq 5000 -g -- sleep 5 | ||
perf script > perf.script | ||
``` | ||
|
||
Then upload the `perf.script` file to [Firefox Profiler](https://profiler.firefox.com). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.