AWS SDK for Rust takes ~900ms on first request — TLS handshake is 99%
While writing a Lambda Rust + DynamoDB benchmark, I noticed the first request after a cold start took 912ms. Init Duration itself was only 112ms — fast. Yet the first DynamoDB call was abnormally slow.
Breaking down the latency revealed that TLS handshake averages 745ms, accounting for 99% of the total. DNS resolution is 7.3ms, TCP connection is under 1ms. At 128MB (roughly 7% of a vCPU), TLS cryptographic processing is extremely expensive.
DNS: 7.3ms (1%)
TCP: 0.7ms (0%)
TLS: 745ms (99%)The fix: run client.list_tables().limit(1).send().await once during Init to warm the connection. This drops first Duration from 912ms to 21ms (82% reduction in total Billed Duration). Use let _ = to ignore the result so Init succeeds even if warming fails.
