1 Answer
- Newest
- Most votes
- Most comments
0
I can only provide a partial answer on how to measure what is happening between Cloudfront and origin.
If you enable access logging on the ALB, you will be able to determine TLS session reuse (value session-reused
in the chosen_cert_arn
field) and, by approximation, TCP connection reuse (HTTP keepalive) by matching up the client_ip
, client_port
, target_ip
, target_port
tuple.
answered 3 years ago
Sure.This helps a bit.
I added a comment to my question.Even the alb logs dont show high latency, not sure why cloudfront is taking that time.Even the same connection is used.
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 9 months ago
I enabled the loadbalancer logs and was able to find the below
Origin Latency from logs: 0.059
https 2022-04-14T12:07:34.438950Z app/awseb-AWSEB-@#$$$$$$$/33c31cf831229bd5 70.132.30.168:19320 172.31.30.35:80 0.001 0.059 0.000 200 200 1091 15561 "GET https://mywebsite.co:443/ HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/awseb-AWSEB-CO4F476RJ4O0/e54f61d50c1c75c9 "Root=1-62580e86-1411f5a823d9bc5f7dc1df7e" "mywebsite.co" "session-reused" 0 2022-04-14T12:07:34.378000Z "forward" "-" "-" "172.31.65.35:80" "200" "-" "-"
which means, the connection was reused from cloudfront.But still it took 800ms for TTFB.We are accessing the server in virgina from mumbai region.The round trip latency is around 200ms.Puzzled why is the cloudfront node in mumbai where our request went to, is taking 800ms even though it used the same connection to alb which responded in around 60ms.Not sure something is wrong.
Well, given that the TLS session was reused, the TCP connection was not reused (please double-check adresses/ports). This means that a TCP three-way handshake had to be performed, and given a 200 ms RTT (which seems low for VA to Mumbai), 800 ms TTFB would appear to be within expectations.
Also the first field is https, ideally I expected cloudfront to use http2 with origin
I enabled the keepalive on cloudfront.So due to that tls session is reused ? I assumed that helps in reusing the tcp connection as well. How can I check if the tcp connection is reused ? Even if the tcp handshake was happening again, the rtt is 200 ms, so for a 3 way handshake it should be 300ms = (200 + 100) right ? So is using cloudfront a good option in this case as we donno for how many of the given requests, the tcp or tls session is reused.