A city Lambda pays TCP/TLS handshake costs on every invoke when creating new HTTP and AWS SDK clients inside the handler. What reuse pattern helps?
Select an answer to reveal the explanation.
Short Explanation
Handshaking TLS on every citizen click is like reintroducing yourself every sentence. Build the HTTP/SDK clients once outside the handler and reuse them on warm invokes. You skip the hello ritual and shave latency.
Full Explanation
Lambda performance best practices include initializing SDK and HTTP clients outside the handler so warm execution environments reuse connections and avoid repeated TCP/TLS handshakes. Creating clients per call, disabling keep-alive, or forcing environment restarts increases overhead. Connection reuse is a standard Domain 4 optimization.