Files
firezone/rust/Cargo.toml
Thomas Eizinger 5bf3230c62 docs(connlib): add profiling instructions (#6643)
Documents profiling instructions that I've figured out over the last
couple of days. Since Rust 1.79, the standard library is compiled with
frame pointers enabled [0]. Grabbing stack-trace information from the
frame pointer makes profiling much easier because the data is just there
in-line. Using debug information (via `dwarf`) is also possible but
requires post-processing of the performance profile with `addr2line`
(`perf script` does that automatically). This can take multiple minutes
or longer, depending on the sampling frequency of the captured
performance data. This makes benchmarking almost infeasible because the
feedback loop is simply too long. Using frame pointers is a much nicer
experience.

The downside is that the application themselves also needs to be
compiled with frame pointers. We achieve that by setting the appropriate
compiler option in `.cargo/config.toml`. Ubuntu [1], Fedora [2] and Arch
[3] also ship all of their code with frame pointers enabled. Also, tech
giants such as Google & Meta have been running their systems with frame
pointers on-by-default for years [4].

[0]:
https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#frame-pointers-enabled-in-standard-library-builds
[1]:
https://www.brendangregg.com/blog/2024-03-17/the-return-of-the-frame-pointers.html
[2]: https://pagure.io/fesco/issue/2923
[3]: https://gitlab.archlinux.org/archlinux/rfcs/-/merge_requests/26
[4]:
https://www.brendangregg.com/blog/2024-03-17/the-return-of-the-frame-pointers.html
2024-09-10 14:00:00 +00:00

109 lines
4.0 KiB
TOML

[workspace]
members = [
"bin-shared",
"connlib/clients/android",
"connlib/clients/apple",
"connlib/clients/shared",
"connlib/shared",
"connlib/snownet",
"connlib/tunnel",
"gateway",
"gui-client/src-common",
"gui-client/src-tauri",
"headless-client",
"ip-packet",
"logging",
"phoenix-channel",
"relay",
"socket-factory",
"tests/gui-smoke-test",
"tests/http-test-server",
"tun"
]
resolver = "2"
[workspace.dependencies]
boringtun = { version = "0.6", default-features = false }
chrono = { version = "0.4", default-features = false, features = ["std", "clock", "oldtime", "serde"] }
swift-bridge = "0.1.57"
backoff = { version = "0.4", features = ["tokio"] }
tracing = { version = "0.1.40" }
tracing-subscriber = { version = "0.3.17", features = ["parking_lot"] }
secrecy = "0.8"
hickory-resolver = { git = "https://github.com/hickory-dns/hickory-dns", rev = "a3669bd80f3f7b97f0c301c15f1cba6368d97b63", features = ["tokio-runtime"] }
hickory-proto = { git = "https://github.com/hickory-dns/hickory-dns", rev = "a3669bd80f3f7b97f0c301c15f1cba6368d97b63" }
str0m = { version = "0.6.2", default-features = false }
futures-bounded = "0.2.1"
domain = { version = "0.10", features = ["serde"] }
dns-lookup = "2.0"
tokio-tungstenite = "0.23.1"
rtnetlink = { version = "0.14.1", default-features = false, features = ["tokio_socket"] }
tokio = "1.39"
rustls = { version = "0.23.10", default-features = false, features = ["ring"] }
connlib-client-android = { path = "connlib/clients/android" }
connlib-client-apple = { path = "connlib/clients/apple" }
connlib-client-shared = { path = "connlib/clients/shared" }
firezone-gateway = { path = "gateway" }
firezone-headless-client = { path = "headless-client" }
firezone-gui-client = { path = "gui-client/src-tauri" }
firezone-logging = { path = "logging" }
firezone-bin-shared = { path = "bin-shared" }
snownet = { path = "connlib/snownet" }
firezone-relay = { path = "relay" }
connlib-shared = { path = "connlib/shared" }
firezone-tunnel = { path = "connlib/tunnel" }
phoenix-channel = { path = "phoenix-channel" }
ip-packet = { path = "ip-packet" }
socket-factory = { path = "socket-factory" }
tun = { path = "tun" }
socket2 = { version = "0.5" }
[workspace.lints.clippy]
dbg_macro = "warn"
print_stdout = "warn"
print_stderr = "warn"
unnecessary_wraps = "warn"
unused_async = "warn"
wildcard_enum_match_arm = "warn" # Ensures we match on all combinations of `Poll`, preventing erroneous suspensions.
redundant_else = "warn"
redundant_clone = "warn"
[workspace.lints.rustdoc]
private-intra-doc-links = "allow" # We don't publish any of our docs but want to catch dead links.
[patch.crates-io]
boringtun = { git = "https://github.com/cloudflare/boringtun", branch = "master" }
str0m = { git = "https://github.com/algesten/str0m", branch = "main" }
ip_network = { git = "https://github.com/JakubOnderka/ip_network", branch = "master" } # Waiting for release.
ip_network_table = { git = "https://github.com/edmonds/ip_network_table", branch = "some-useful-traits" } # For `Debug` and `Clone`
proptest = { git = "https://github.com/proptest-rs/proptest", branch = "master" }
proptest-state-machine = { git = "https://github.com/proptest-rs/proptest", branch = "master" }
tracing-stackdriver = { git = "https://github.com/thomaseizinger/tracing-stackdriver", branch = "deps/bump-otel-0.23" } # Waiting for release.
[profile.release]
strip = true
# Full link-time optimization. Reduces binaries by up to 3x on some platforms.
lto = "fat"
# Increases the compiler's ability to produce smaller, optimized code
# at the expense of compilation time
codegen-units = 1
[profile.bench]
strip = false # Frame pointers are necessary for profiling; `strip=true` appears to remove them.
# Override build settings just for the GUI client, so we get a pdb/dwp
# Cargo ignores profile settings if they're not in the workspace's Cargo.toml
[profile.dev.package.firezone-gui-client]
debug = "full"
split-debuginfo = "packed"
strip = "none"
[profile.release.package.firezone-gui-client]
debug = "full"
split-debuginfo = "packed"
strip = "none"