fix: fix heappy + update docs (#4917)

* docs: Update heap profiling documentation

* fix: fix heappy builds

* fix: do not run cli tests with heappy

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Andrew Lamb 2022-06-21 15:53:28 -04:00 committed by GitHub
parent 59accfe862
commit 087dbd3eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 2 deletions

2
Cargo.lock generated
View File

@ -2066,7 +2066,6 @@ dependencies = [
"futures",
"generated_types",
"hashbrown",
"heappy",
"http",
"humantime",
"influxdb_iox_client",
@ -2392,6 +2391,7 @@ dependencies = [
"futures",
"generated_types",
"hashbrown",
"heappy",
"http",
"hyper",
"log",

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

View File

@ -54,3 +54,21 @@ For example, if you aim your browser at an IOx server with a URL such as http://
You will see a beautiful flame graph such as
![Flame Graph](images/flame_graph.png)
# IOx — Heap Profiling
IOx includes a memory heap profile tool as well as a CPU profiler. The memory usage tool is based on [heappy](https://github.com/mkmik/heappy)
Support is is not compiled in by defauly, but must be enabled via the `heappy` feature:
```shell
# Compile and run IOx with heap profiling enabled
cargo run --no-default-features --features=heappy -- run all-in-one
```
Now, you aim your browser at an IOx server with a URL such as http://localhost:8080/debug/pprof/allocs?seconds=5
You will see a green flamegraph such as
![Heappy Graph](images/heappy_graph.png)

View File

@ -62,7 +62,6 @@ tonic = "0.7"
uuid = { version = "1", features = ["v4"] }
# jemalloc-sys with unprefixed_malloc_on_supported_platforms feature and heappy are mutually exclusive
tikv-jemalloc-sys = { version = "0.4.0", optional = true, features = ["unprefixed_malloc_on_supported_platforms"] }
heappy = { git = "https://github.com/mkmik/heappy", rev = "5d47dff152b8430e1dc1aea5a54c91c0c3099219", features = ["enable_heap_profiler", "jemalloc_shim", "measure_free"], optional = true }
workspace-hack = { path = "../workspace-hack"}
[dev-dependencies]
@ -82,6 +81,7 @@ azure = ["clap_blocks/azure"] # Optional Azure Object store support
gcp = ["clap_blocks/gcp"] # Optional GCP object store support
aws = ["clap_blocks/aws"] # Optional AWS / S3 object store support
pprof = ["ioxd_common/pprof"] # Optional http://localhost:8080/debug/pprof/profile support
heappy = ["ioxd_common/heappy"] # Optional http://localhost:8080/debug/pproc/alloc support
# Enable tokio_console support (https://github.com/tokio-rs/console)
#

View File

@ -1,4 +1,7 @@
mod all_in_one;
// CLI errors when run with heappy (only works via `cargo run`):
// loading shared libraries: libjemalloc.so.2: cannot open shared object file: No such file or directory"
#[cfg(not(feature = "heappy"))]
mod cli;
mod debug;
mod error;

View File

@ -11,6 +11,7 @@ clap_blocks = { path = "../clap_blocks" }
data_types = { path = "../data_types" }
dml = { path = "../dml" }
generated_types = { path = "../generated_types" }
heappy = { git = "https://github.com/mkmik/heappy", rev = "5d47dff152b8430e1dc1aea5a54c91c0c3099219", features = ["enable_heap_profiler", "jemalloc_shim", "measure_free"], optional = true }
metric = { path = "../metric" }
metric_exporters = { path = "../metric_exporters" }
mutable_batch_lp = { path = "../mutable_batch_lp" }