Serverless lambda response times Postman vs Deployed App

424 views Asked by At

This is more of a infrastructure question. I'm in the means of developing a new serverless project for myself and I have a question regarding response times.

Architecture: 
Frontend: S3 + CloudFront - React App
Backend: API Gateway + Lambda (Node.js) + DynamoDB

I did a test route with a lambda function that returns a simple response with API Gateway + Lambda.

When calling it with postman I get a long response for the cold start, but afterwards I get response times between 80-120 ms, which are acceptable I suppose.

But I am doing the call with Postman from my actual pc and network.

Will these response times get better once I will deploy the actual frontend app to S3 + Cloudfront in the same zone as were the backend resides - since everything is in the infrastructure of AWS, is the call made in AWS network behind the scenes from React to the Lambda function?

Or they users using the app will still receive 120+ ms response times on each call?

Thanks.

2

There are 2 answers

1
Mark B On BEST ANSWER

Will these response times get better once I will deploy the actual frontend app to S3 + Cloudfront in the same zone as were the backend resides - since everything is in the infrastructure of AWS, is the call made in AWS network behind the scenes?

Your React app will simply be stored on AWS resources. The React app's files will be served to a visitor's web browser by S3 + CloudFront. The React app actually runs inside the user's web browser. None of your React code is actually "running" in AWS.

So no, the response times won't get any better.

2
doglover1337 On

enter image description here

enter image description here

The interesting thing is that the actual lambda execution I get in AWS is rather small.

In the 60ms count.

So the other 60-80ms I get is due to network traffic from my geographical location to the actual lambda and back ?

So all my users will receive this added ms response because we are located geographically a bit far from the AWS lambda?

Is there a way around this? Or to somehow optimise it?