Binary size

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 custom

Check size

ll target/release/vertex

Strip 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/binary

Or, modify the Cargo.toml

Cargo.yaml
[profile.release]
strip = true

Reduce 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 = 1

Others

And there are many options to reduce the memory size, see min-sized-rust.