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
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:
-Clink-args=-zstack-size=65536RUSTFLAGS="-Clink-args=-zstack-size=65536" cargo build ...println!("cargo:rustc-cdylib-link-arg=-zstack-size=65536");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:
println!("cargo:rustc-cdylib-link-arg=-zstack-size=65536");rustc-cdylib-link-argtransitive warning rust-lang/cargo#9562warning: proxy-wasm@0.2.3-dev: 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 targetCC @mpwarres @PiotrSikora