Cloudfront content download speed is too slow.

0

Cloudfront was deployed using Origin on the ALB connected to the web server. Using Managed Policy, static files are subject to the CachingDisabled policy, and dynamic files are subject to the CachingOptimized and AllViewer policies.

Content download speed is too slow in the browser regardless of the cache policy in place. It doesn't matter for small files, but for large images, fonts, etc., the download time may exceed 1 minute.

This problem does not exist when attached directly to EC2 or LB.

I need help solving what the problem is.

jh
asked 5 months ago365 views
2 Answers
2

Hi jh,

Follow the below steps you can take to troubleshoot the issue:

  1. Check CloudFront Logs: Enable logging in CloudFront and check the logs to see if there are any errors or delays reported during file downloads.

  2. Review Cache Policies: Double-check the cache policies applied to your CloudFront distribution. Ensure that the caching configurations for static and dynamic files are correctly set up.

  3. Origin Response Time: Check the response time from your ALB when CloudFront requests files. Slow response times from the ALB could contribute to overall download delays.

  4. Compression Settings: Ensure that compression settings are optimized both at the ALB level and within CloudFront. Compressing files can help reduce download times, especially for larger assets.

  5. Origin Shield: Consider implementing an Origin Shield to reduce the load on your ALB and improve response times for CloudFront requests.

  6. Network Latency: Investigate potential network latency issues between CloudFront and your ALB. This could involve reviewing network configurations and routing.

7.Resource Optimization: Optimize your web server configuration, including settings related to TCP connection handling, keep-alive timeouts, and maximum concurrent connections.

EXPERT
answered 5 months ago
  • I tried it, but it didn't work. What is the impact of the cache-control Header returning no-cache?

1

Using Managed Policy, static files are subject to the CachingDisabled policy, and dynamic files are subject to the CachingOptimized and AllViewer policies.

Can you share the AWS Region your ALB is in? If you are using Origin Shield, make sure you use nearest Region. Else disable it.

Also, should the caching be reversed? i.e.

  • Static files : CachingOptimized
  • Dynamic files: CachingDisabled

Edit: You are in ap-northeast-2 Seoul Region. Do ensure you select the correct Price class. There are 3

  1. Use all edge locations (best performance)
  2. Use only North America and Europe
  3. Use North America, Europe, Asia, Middle East, and Africa

Item 2 (North America and Europe) is not appropriate for your use case

Also check if CloudFront is caching your static content. You may have to browse your web site a few timees. To verify, use web browser developer tools. Go to network, select a static content, and check Headers, Response (screenshot below).

Enter image description here

A X-Cache value of Hit from cloudfront indicates caching. The X-Amz-Cf-Pop value is indicative of your POP location. Korea is likely ICN*

AWS
EXPERT
MikeLim
answered 5 months ago
  • The Origin Shield is not in use, and the ALB is in ap-northeast-2.

  • ops... That's a typo. It is set (Static files : CachingOptimized), (Dynamic files: CachingDisabled)

  • Thanks for your help! I am using item 3 and have also confirmed that caching is working well. Unfortunately, it hasn't been resolved yet.

    However, I confirmed that CloudFront is Singapore location. Origin is Seoul region and Edge Location is Singapore, I was connecting from Seoul. I think this is the reason why the content download speed is faster when accessing Origin directly than when accessing CloudFront. Could this be the cause?

    Or maybe it has something to do with the cache-control Header being no-cache?

    • Actually, I tested the connection in the ap-southeast-1 region and confirmed that the content download speed was fast.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions