Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrink wasm stack size #308

Open
martijneken opened this issue Mar 17, 2025 · 0 comments
Open

Shrink wasm stack size #308

martijneken opened this issue Mar 17, 2025 · 0 comments

Comments

@martijneken
Copy link
Contributor

martijneken commented Mar 17, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant