Skip to content

Shrink wasm stack size #308

Open
Open
@martijneken

Description

@martijneken

Benchmarking has determined that the default wasm stack size is 1 MiB. This is quite a lot for small server environments, thus in the C++ SDK we set both stack size and initial heap to 64 KiB: proxy-wasm/proxy-wasm-cpp-sdk#174

In Rust the stack size can be set as follows:

  • Bazel rustc_flags: -Clink-args=-zstack-size=65536
  • Cargo CLI: RUSTFLAGS="-Clink-args=-zstack-size=65536" cargo build ...
  • build.rs: println!("cargo:rustc-cdylib-link-arg=-zstack-size=65536");
  • config.toml (not tested): rustflags = ["-C", "link-args=-zstack-size=65536"]

Is there a good way to get the Rust SDK to influence / set this value? It's not ergonomic for every user of proxy-wasm-rust-sdk to define their own build.rs file or config.toml file or use command line build parameters.

There is one way I know to accomplish this, but it comes with caveats:

CC @mpwarres @PiotrSikora

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions