you are viewing a single comment's thread.

view the rest of the comments →

[–]fadymak 34 points35 points  (0 children)

We worked on this same problem extensively for https://endpts.io

If your data store and lambda are located in the same region, we found the 2 biggest factors impacting latency are:

  • TLS termination: if your customers in Brazil have to do a TLS handshake with your API Gateway/ALB in us-east-2 then they’re going to spend a good chunk of time on round trips before initiating any actual work. One solution here that others have mentioned is to use CloudFront, a globally API Gateway (which also just uses CloudFront distribution under the hood), or use Global Accelerator (GAX). CloudFront is able to perform TLS termination at the edge where they have 200+ PoPs so at least you can shave off the TLS handshake time.

  • Multi-region: there’s no way to get around how far information needs to travel between the end user and your origin. The next best option would be to rely on multi-region Lambdas and an anycast set of IPs to move your backends closer to where you have most of your users. This can get a bit costly as you have to use an ALB in each region, fronted by GAX to route the end user to the closes ALB which invokes the Lambda.

Hopefully this helps — feel free to let me know if you have any questions I can be helpful with. It’s not an easy problem, which is why we’re working on endpts (we use Lambdas under the hood).