wpsharks / comet-cache-kb

The Comet Cache™ Knowledge Base
https://cometcache.com/kb/
1 stars 1 forks source link

Static CDN Filters for WordPress Multisite Networks #73

Open raamdev opened 9 years ago

raamdev commented 9 years ago

KB Article Creation Checklist

Additional TODO list items go here.


KB Article Published @ zencache.com
:page_with_curl: See: Static CDN Filters for WordPress Multisite Networks

:octocat: View Markdown File | :pencil2: Edit Markdown File


jaswrks commented 8 years ago

In this article, we state that...

https://zencache.com/kb-article/static-cdn-filters-for-wordpress-multisite-networks/#toc-8a1cfcbb

... the only reason you would configure multiple CDN domain names is to take advantage of Domain Sharding.

That's not necessarily true. I recently found another use case for this. A site owner can (or at least, should be able to) exclude one or more of their domains by omitting it from the Static CDN Filter configuration file. Referencing my comments here: https://github.com/websharks/zencache/issues/657#issuecomment-184648872

BookClubs commented 8 years ago

My knowledge of servers / domains is pretty low. I'm running in to some issues that might point out some holes in your documentation's abilities to address users at my level. I have added Comet Cache to a multisite network (mapped domains). I created an Amazon Cloudfront account, and deployed several distributions (one for each domain). Then, I added the following types of lines to the CDN section of Comet Cache (domain.com = awsurl.cloudfront.net). I did not make any changes to my domain registrar's DNS setting or cPanel.

In prior emails with you guys, you stated that nothing more needed to be done. However, in checking my distribution, I can't find any evidence of my site being served through Cloudfront. Today, I was watching a video about W3 Total Cache to see how they set up their AWS / cPanel settings b/c it appears that this is not working for me. The guy created CNAME records in cPanel and at his domain registrar account. So, I'm a bit confused. I feel like I'm missing steps that might be obvious to your average user, but not to a beginner like myself.

Have I missed something here?

jaswrks commented 8 years ago

Then, I added the following types of lines to the CDN section of Comet Cache (domain.com = awsurl.cloudfront.net). I did not make any changes to my domain registrar's DNS setting or cPanel.

What you're giving Comet Cache is just a CDN Host Name that works for the domain you're mapping it to. In your example, awsurl.cloudfront.net has a 'source' domain of domain.com.

Assuming you've setup and configured awsurl.cloudfront.net with domain.com as the source (i.e., configured this on the CDN side), then that's all you need to do :-)

I suggest this video: https://cometcache.com/kb-article/how-do-i-setup-static-cdn-filters-w-amazon-cloudfront/

The guy created CNAME records in cPanel and at his domain registrar account.

This is optional. Creating a CNAME would allow you to use something like cdn.mydomain.com in place of awsurl.cloudfront.net; where cdn.mydomain.com is a CNAME that points to awsurl.cloudfront.net. So using the CNAME you're saying the same thing, just using a domain of your own instead of the default host name provided by your CDN.

BookClubs commented 8 years ago

Hi Jason,

Thanks for your answer. I have set up the CDN as shown in the video. When I turn Static CDN filters on/off in Comet Cache, there is little difference in speed. In fact, when measuring with Pingdom (multiple test), it's actually faster by roughly 1/10th of a second on average when the filters are off.

  1. How can I test if the filters are working correctly?
  2. Is it possible to use domain sharding with a domain-mapped multisite network? How would that work with your plugin?
  3. If I set up a CNAME record, do I use www or address in the Host field? And, what do I put in the Value field, cdn.mydomain.com or the Amazon URL?
  4. Once I create the CNAME record, do I add this to the CDN distribution and Comet Cache?

Thanks for your help Chris

On Wed, Aug 17, 2016 at 8:12 AM, jaswsinc notifications@github.com wrote:

Then, I added the following types of lines to the CDN section of Comet Cache (domain.com = awsurl.cloudfront.net). I did not make any changes to my domain registrar's DNS setting or cPanel.

What you're giving Comet Cache is just a CDN Host Name that works for the domain you're mapping it to. In your example, awsurl.cloudfront.net has a 'source' domain of domain.com.

Assuming you've setup and configured awsurl.cloudfront.net with domain.com as the source (i.e., configured this on the CDN side), then that's all you need to do :-)

I suggest this video: https://cometcache.com/kb- article/how-do-i-setup-static-cdn-filters-w-amazon-cloudfront/

The guy created CNAME records in cPanel and at his domain registrar account.

This is optional. Creating a CNAME would allow you to use something like cdn.mydomain.com in place of awsurl.cloudfront.net; where cdn.mydomain.com is a CNAME that points to awsurl.cloudfront.net. So using the CNAME you're saying the same thing, just using a domain of your own instead of the default host name provided by your CDN.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/websharks/comet-cache-kb/issues/73#issuecomment-240393068, or mute the thread https://github.com/notifications/unsubscribe-auth/ALI4fk_bYNChGVJ-TJg1oc0BUtXd8kISks5qgvqhgaJpZM4EkMCW .

BookClubs commented 8 years ago

Hi guys,

A couple of additional questions

  1. Can I create multiple distributions for the same domain with the goal of each distro serving a different part of the site (e.g. media files or a high-load plugin, etc.)? If so, how would I go about doing this?
  2. For media rendered from the edge servers, should the URLs show the amazon CDN URL, or the TLD URL for the actual website?

Thanks, Chris

jaswrks commented 8 years ago

Can I create multiple distributions for the same domain with the goal of each distro serving a different part of the site (e.g. media files or a high-load plugin, etc.)? If so, how would I go about doing this?

It's possible to do this, yes. Most CDNs allow you to define a source 'domain' and also a source 'path'. So for instance, using a service like Amazon Cloudfront you should be able to create multiple distributions that all point to the same domain, but perhaps to different folders on that domain.

Having said that, there's no way to tell Comet Cache about that at this time; i.e., Comet Cache would need the same sort of mapping, and there is no feature at present that would allow you to do this I'm afraid. You can give Comet Cache multiple CDN Host Names, but those are used for Domain Sharding, and not as a way to apply specific CDN Host Names to specific folders.

(e.g. media files or a high-load plugin, etc.)?

Which brings me to your example. I see no benefit in doing it this way, because a CDN, by definition, is a distributed network of servers already. So what benefit would there be to filtering based on the folder? I'd love to hear more about a use case where that would be beneficial.

If the example you have in mind is related to headers for different file classifications, then I would point you instead to 'Behaviors' on the CDN side. See: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesCacheBehavior

For media rendered from the edge servers, should the URLs show the amazon CDN URL, or the TLD URL for the actual website?

It should show the CDN URL, because that's what will be requested by a visitor.

BookClubs commented 8 years ago

Thanks for your answers. To your last answer, the media on my sites are being displayed with the TLD URL. So, I can assume that Amazon's Cloudfront is not working for me. I've set up the distributions exactly as shown in your video, and I've added them to Comet Cache as shown. When Static DNS is turned on, site speed actually slows down.

Given that these sites are being run on a managed cloud hosting account, adding Cloudfront is just an added layer of redundancy ... and the closest servers are my own in the cloud.

  1. Does that sounds about right?

Using Query Monitor, I believe I've narrowed down my site's speed issues to a forms plugin. So, I will remove Static CDN for now. Does all of this sound logical?

Thanks, Chris