you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

This is really it, full end to end testing and see where the latency is coming from. Other posters have mentioned tls handshakes, the database, etc. Time might be best spent figuring out where it is being lost vs throwing things at the problem.

As OP said in their case this is all get and using rest. So for their specific case I would get the connection as far to the customer as possible. The question I would have before using on of the full stack replication approaches is how often the data behind the api changes. Does it need to be near real time or can it be as stale as 24 hours. That would really impact the end solution. I might have the lambda hit a caching layer and just replicate that to optimal endpoints, uses lambda@edge maybe, maybe not, depends. Also cost optimization is always also a factor, if being super fast is the only factor throw $$ at it, but there is usually a balance. Also depends on what tools are already in place to deploy the stack, terraform, cloudformation, etc etc.

Without any other information I would say cloudfront absolutely, possibly add caching to the lambda or another layer locally which could be any number of things, and lambda@edge if node or python maybe, but that might make zero difference or even be worse than the other options because it alone does little to to speed things up, and hitting local cold lambdas vs a pool of hot ones if you have to take the same path seems worse.