How to decrese latency of invoking Lambda from Worker

I use Cloudflare Worker that for some requests synchronously invokes Lambda function using AWS API (aws4fetch).

Implementation is working, but compared to other options for invoking Lambda (ALB / Api Gateway…) there is extra 200-300ms latency measured end-to-end making request from residential network.

There is only one fetch request to AWS API per Worker request.

  1. Should I expect connection to AWS API to stay open (eg. “keep-alive”) for the next request?

  2. Any ideas for additional optimizations I could add to the fetch call?

I’m also triggering Lambdas from Workers, I found no way to improve the latency.

This is basically a fundamental issue with any distributed system and serverless in general, you always add the DNS lookup & HTTPS handshake latency to the request and there’s no way to trigger the worker from a region closer to the AWS Lambdas.

“keep-alive” won’t work since the lifetime of the worker is limited.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.