Replies: 2 comments
-
|
The awslabs/aws-lambda-rust-runtime repository might be a better place to discuss this since it affects the runtime more than cargo lambda. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I would not mind adding this as a default to all builds, but I don't have enough information about it to make an informed decision. The Runtime maintainers have direct access to the AWS-Lc-RS maintainers, so they might be able to provide better guidance. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
The
aws-lc-rscrate uses CPU jitter entropy by default, which incurs a one-time-per-process latency cost. On traditional servers this cost is negligible, but on AWS Lambda it has a significant impact on cold start times.This is particularly unfortunate as it makes Rust appear significantly slower than other runtimes for Lambda, when the real culprit is a single build flag.
Any Lambda using a crate that relies on aws-lc-rs for cryptography is affected, which in practice means virtually all Rust Lambda functions using the AWS SDK.
Measured Impact
I did a micro-benchmark for cold starts of a Lambda calling DDB, averaging multiple iterations (20) to reduce network latency / DDB warmup impact.
AWS_LC_SYS_NO_JITTER_ENTROPY=1Setting
AWS_LC_SYS_NO_JITTER_ENTROPY=1at build time reduces cold starts by ~4x at 128MB and still ~30% even at 2GB.aws-lc-rsmust be an explicitly declared dependency for this to work.Discussion
I'm not sure if cargo-lambda can do much about this, as everyone using it has to decide if the second source of randomness is a security requirement for them. It seems some environments and frameworks disable it (see linked references).
Maybe documentation is the right answer here, but I'm curious if anyone has ideas for something more proactive (a build info? a template flag?). If it's documentation, where would it best fit?
References
Beta Was this translation helpful? Give feedback.
All reactions