I am using AWS and setup a VPC in us-west-2. There are public and private subnets in zone B and C. Mainly I use zone b only.
I have a NAT Gateway in public subnet in zone B and a t3a.large EC2 instance in private subnet in zone b too. I can run curl https://google.com/
in my t3a instance in private subnet and the response time is very fast.
For ALB my setup is to listen 443 and forward it to my instance. I can curl locally on my instance and the respond time is very low too. However I am not sure why it is very very slow if I browse it with browser for the first time.
My application is full of XHR, and the slow response time only affect the very first request, for all sequential requests they are all fast.
When I have passed the first slow request and up to speed for me now. Another user with another computer starting to visit our site suffer from slow response time as he is newly visiting our site. The slow response time is definitely not caused by session or file transfer related issues.
Any ideas on what would be wrong?
question from:
https://stackoverflow.com/questions/65622842/slow-response-for-the-first-request-with-aws-alb 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…