简体   繁体   English

Cloudfront似乎并没有提高网站的性能

[英]Cloudfront doesn't seem to boost site's performance

My Wordpress site used s3 for images. 我的Wordpress网站使用s3拍摄图像。 Now I've integrated it with cloudfront distribution hoping that it would further boost the performance but its has dropped drastically. 现在,我将其与Cloudfront分发集成在一起,希望它可以进一步提高性能,但是其性能却急剧下降。

As I checked, the cloudfront distribution is working as in it can load object/image from the cloudfront domain. 正如我检查的那样,cloudfront分发正在运行,因为它可以从cloudfront域中加载对象/图像。 But I noticed the images in the site refering to the previous s3 link/path not the cloudfront domain. 但是我注意到站点中的图像是指以前的s3链接/路径,而不是cloudfront域。

So is my site really loaded with cloudfront and how do I verify that. 我的网站上是否真的装有Cloudfront,我该如何验证。 If it is then why is it slowing down the performance.What is the proper way to increase it? 如果是这样,为什么会降低性能呢?提高性能的正确方法是什么?

Cloudfront is more like a caching mechanism and the way it speeds up your website is by caching it for some time close to the source that is performing the request. Cloudfront更像是一种缓存机制,它通过在与执行请求的源接近的地方缓存一段时间来加速网站。

One of the things Cloudfront does is replace all URLs that points to an origin by a custom DNS ending in *.cloudfront.net or one that you provided. Cloudfront要做的一件事是,用以* .cloudfront.net结尾的自定义DNS或您提供的URL替换所有指向源的URL。 URLs that point somewhere else from this source are not cached and it includes S3. 从此源指向其他地方的URL不会被缓存,它包括S3。

Theres nothing wrong by using S3 and the problem surely lies somewhere else. 使用S3没错,问题肯定出在其他地方。

To verify that your Cloudfront distribution is working correctly you can use a tool like Postman or curl to get the headers returned from your page. 要验证您的Cloudfront发行版是否正常工作,可以使用诸如Postman或curl之类的工具来获取页面返回的标题。

You should have a header named X-Cache and it usually responds with: X-Cache: Miss from cloudfront or X-Cache: Hit from cloudfront . 您应该有一个名为X-Cache的标头,它通常会响应: X-Cache: Miss from cloudfrontX-Cache: Hit from cloudfront

If you get many misses your config is probably not optimal. 如果您错过了很多,则您的配置可能不是最佳的。

You should also check the price class used in your distribution. 您还应该检查分配中使用的价格类别。 The price class will let you know what regions your website is being cached. 价格类别将让您知道您的网站正在缓存的区域。 Please check this link and a bit further down you see the price class types: 请检查此链接 ,再往下看,您会看到价格类别类型:

  • Price Class 100 being in United States, Canada and Europe 价格类别100在美国,加拿大和欧洲
  • Price Class 200 being in everywhere except Australia and South America 除澳大利亚和南美洲以外,其他地区的价格都在200级
  • Price Class All being in all regions available 价格等级所有地区都可用

As a side note you should post images showing the origin and behavior configurations that you did to enhance your question. 作为旁注,您应该发布显示您为增强问题而进行的来源和行为配置的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM