Open
Description
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:
- Add this line to the SDK's build.rs:
println!("cargo:rustc-cdylib-link-arg=-zstack-size=65536");
- This works but is not officially supported: Tracking issue for
rustc-cdylib-link-arg
transitive warning rust-lang/cargo#9562 - See also discussion on this issue: rustc-link-arg does not propagate transitively rust-lang/cargo#9554
- It also generates a build warning:
warning: [email protected]: cargo:rustc-cdylib-link-arg was specified in the build script of proxy-wasm v0.2.3-dev (/usr/local/google/home/mstevenson/git/proxy-wasm-rust-sdk), but that package does not contain a cdylib target
Metadata
Metadata
Assignees
Labels
No labels