Binary size
This page demonstrates how to minimize the size of vertex binary.
Remove unused components
By default, vertex contains all components (if possible), but you might not need all of them, so you can disable whatever you don’t want.
Add your own feature
Cargo.yaml
[features]
custom = [
"sources-node",
"sinks-prometheus_exporter"
]Build
cargo build --release --no-default-features --features customCheck size
ll target/release/vertexStrip Symbols from Binary
By default, on Linux and macOS, symbol information is included in the compiled .elf file.
This information is not needed to properly execute the binary.
You can strip the binary manually
strip /path/to/the/binaryOr, modify the Cargo.toml
Cargo.yaml
[profile.release]
strip = trueReduce Parallel Code Generation units
Cargo will use as many as possible(<= 16) for code generating, This increase compile times
and more inline optimization.
Set this to 1 in Cargo.toml to allow for maximum size reduction optimization
Cargo.yaml
[profile.release]
codegen-units = 1Others
And there are many options to reduce the memory size, see min-sized-rust.