Micro Benchmarks
We have micro benchmarks for various components such as storage, stream and batch executors.
Running Micro Benchmarks
You can run them by specifying their name.
For instance to run json_parser
micro benchmark:
cargo bench json_parser
Generating Flamegraph for Micro Benchmarks
Note: Flamegraph generation depends on
perf
. You will need a linux box to run it.
-
Install
cargo-flamegraph
cargo install flamegraph
-
Install
perf
. If on ubuntu:sudo apt install linux-tools
If using EC2, you may need this instead:
sudo apt install linux-tools-aws
On an EC2 instance you may also need to set
paranoid
level to 1, to give the profiler necessary permissions.sudo sh -c "echo 1 >/proc/sys/kernel/perf_event_paranoid"
-
Run flamegraph + benchmark (change
json_parser
to whichever benchmark you want to run.)cargo flamegraph --bench json_parser -- --bench
Within a benchmark, there are also typically multiple benchmark groups. For instance, within the
json_parser
bench, there’sjson_parser
,debezium_json_parser_(create/read/update/delete)
To filter you can just append a regex. For instance to only benchjson_parser
:cargo flamegraph --bench json_parser -- --bench ^json_parser
You can take a look at Criterion Docs for more information.