- Newest
- Most votes
- Most comments
Hi jh,
Follow the below steps you can take to troubleshoot the issue:
-
Check CloudFront Logs: Enable logging in CloudFront and check the logs to see if there are any errors or delays reported during file downloads.
-
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.
-
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.
-
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.
-
Origin Shield: Consider implementing an Origin Shield to reduce the load on your ALB and improve response times for CloudFront requests.
-
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.
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
- Use all edge locations (best performance)
- Use only North America and Europe
- 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).
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*
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.
Relevant content
- Accepted Answerasked 3 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 3 years ago
I tried it, but it didn't work. What is the impact of the cache-control Header returning no-cache?