Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple CDN cname urls #468

Closed
isaumya opened this issue Apr 15, 2015 · 24 comments
Closed

Allow multiple CDN cname urls #468

isaumya opened this issue Apr 15, 2015 · 24 comments

Comments

@isaumya
Copy link

@isaumya isaumya commented Apr 15, 2015

This is a feature request for HTTP based sites who uses CDN

Currently zencache pro only allow one cdn url to the users to be used. This is great for HTTPS based sites as if you enable SSL on your cdn url, you can only have one cdn url (either on shared ssl of the cdn provider or using your own subdomain name with own ssl certs). But if someone is running a HTTP based site, then he/she can have more than 1 cdn url but creating multiple cname records like cdn1.example.com, cdn2.example.com and so on.
This is also great for paralyzation purpose, so that files can loaded fast over different host/domain names and do not create the bottleneck of the pipelining issue on HTTP 1.1. As HTTP 2.0 has not been released yet, this is a serious problem and using multiple cdn urls, this can be improved a lot if a site loads a lot of resources.
As an example, if you check the config of W#TC, you will see that if you keep adding more cdn urls, it will reserve one cdn url for loading the resourced on <head> and other for footer and rest are used randomly inside body. This is a very good approach to use the best of CDN and HTTP Paralyzation feature.

@raamdev
Copy link
Contributor

@raamdev raamdev commented Apr 16, 2015

@isaumya Thanks so much for the feature request!

@jaswsinc Any thoughts on this?

@jaswrks
Copy link

@jaswrks jaswrks commented Apr 19, 2015

@isaumya writes...

This is also great for paralyzation purpose

Agree completely. I think this is worth doing also.


@raamdev I think this issue could be connected to #439 and completed together at the same time. My feeling is that we need to alter the option key that exists currently (cdn_host) and use cdn_hosts instead (an array).

Array
(
    [example1.com] => Array
        (
            [0] => xxa.cloudfront.net
            [1] => xxb.cloudfront.net
            [2] => xxc.cloudfront.net
            [3] => xxd.cloudfront.net
            [4] => xxe.cloudfront.net
            [5] => ...
        )

    [example2.com] => Array
        (
            [0] => xxf.cloudfront.net
            [1] => xxg.cloudfront.net
            [2] => xxh.cloudfront.net
            [3] => xxi.cloudfront.net
            [4] => xxj.cloudfront.net
            [5] => ...
        )

    [...] => Array
        (
            [0] => ...
        )

)

Then, it's simply a matter of updating the UI (add JavaScript enhancements) and mapping the current host to a CDN that has been configured for that host.

That will add support for multisite networks running subdomain installs, and also make it possible for multiple CDN host names to be configured for a single domain (whether it be in a standard WP install or on a MS network).


If multiple CDN hosts are configured for a single domain, I agree that we should intelligently spread those out to reduce latency. However, it should be noted that one can go too far with this; i.e., too many DNS lookups can be slower than the speed increase you would see from spreading things out. That will be up to the site though. We can provide the ability to do it! :-)

@raamdev
Copy link
Contributor

@raamdev raamdev commented Apr 21, 2015

@jaswsinc Thank you. That sounds like a great plan! I'm marking this as ready for work, along with #439.

@raamdev
Copy link
Contributor

@raamdev raamdev commented Apr 24, 2015

@jsmoriss
Copy link

@jsmoriss jsmoriss commented Apr 24, 2015

+1

@tokar86a
Copy link

@tokar86a tokar86a commented May 5, 2015

Yes this should be awesome.

@codesman
Copy link

@codesman codesman commented May 15, 2015

I need this NOW!! :)

I'm preparing to set up 2 sites on https(custom multi-domain SSL), sharded CNAME domains(for html/img/js/css) with MaxCDN and could use this feature today!

I've forked the repo and I'd love to help in any way I can to get this out the door.

@isaumya
Copy link
Author

@isaumya isaumya commented May 15, 2015

@codesman Man with HTTPS site you can't avail this feature atleast not with MaxCDN (not sure about others). Maxcdn does not support more than 1 HTTPS cname for the cdn. Whether you use their shared ssl or your own ssl cert. You can have atmost 1 cname with the cdn if you are going to use HTTPS.
But with HTTP you have have more than 1 cname records.

@codesman
Copy link

@codesman codesman commented May 15, 2015

@isaumya interesting information as I just got off the phone with MaxCDN and was told this was possible using my own multi-domain cert.

@isaumya
Copy link
Author

@isaumya isaumya commented May 15, 2015

@codesman ask then again, that whether you can have https://cdn1.example.com, https://cdn2.example.com and so on. Because last time I checked, they said it's not possible. So, you better confirm it thoroughly. I'm not sure if they have implemented that recently.

@jaswrks
Copy link

@jaswrks jaswrks commented May 15, 2015

Thanks everyone. I started work on this last week as part of a larger set of changes. We are making steady progress on this, and we will post updates just as soon as we can.

@codesman
Copy link

@codesman codesman commented May 15, 2015

@isaumya thanks for the heads-up. The whole HTTP/2, HTTPS, TLS, CDN, SEO thing is a bit of a clusterfuck huh?

@isaumya
Copy link
Author

@isaumya isaumya commented May 15, 2015

@codesman lolz.... HTTP/2 is still under progress and not released yet. Beside fankily speaking you have waited your money on the multidomain SSL cert. You better wait for : https://letsencrypt.org/

@isaumya
Copy link
Author

@isaumya isaumya commented May 15, 2015

@jaswsinc Thanks for the heads up man. Really appreciate it.

@codesman
Copy link

@codesman codesman commented May 15, 2015

@isaumya yes, I understand this. I suppose I'm referring more to the state of implementing a secure, speedy, seo compliant site in today's technological climate! My research is proving it next to impossible unless you have massive resources.

Haven't bought the cert yet. https://letsencrypt.org/ looks promising!

@raamdev
Copy link
Contributor

@raamdev raamdev commented May 21, 2015

Support for multiple CDN hostnames has been implemented and this feature will go out with the next release:

2015-05-20_21-37-31

@raamdev
Copy link
Contributor

@raamdev raamdev commented May 21, 2015

Next release changelog:

  • Enhancement (Pro): Static CDN Filters now supports multiple CDN hostnames. This allows you to configure more than one CDN hostname, also referred to as Domain Sharding. This makes it possible for site owners to work around web browser concurrency limits, allowing the browser to download many resources simultaneously, which increases overall speed. Props to @isaumya and @jaswsinc. See Issue #468.
@isaumya
Copy link
Author

@isaumya isaumya commented May 21, 2015

Hi @raamdev I have a question i.e. as I'm a single owner of my multisite naturally I don't wanna use different CDN for each different site in the network. I wanna use single cdn for all site in my network, as I mentioned earlier. Also as I'm using HTTPS shared URL of maxcdn so I cannot have more than one cdn url. In this scenario, where should I put my CDN URL? in the first <input type="text" /> section or the textarea section?
It's kind a confusing. Also The paragraph above the textarea is mainly focused to multiple cdn urls. It will be really helpful that where should I put my cdn url.
Thanks for adding this feature.

@raamdev
Copy link
Contributor

@raamdev raamdev commented May 21, 2015

@isaumya Thanks for the feedback. That new text area is titled "Or, Configure Multiple CDN Hostnames", which means you can configure one hostname (the single input field at the top), OR configure multiple hostnames in the text box at the bottom.

I'll see about clarifying that a bit.

@raamdev
Copy link
Contributor

@raamdev raamdev commented May 21, 2015

@jaswsinc Regarding improving the inline documentation and presentation of the new Multiple CDN Hostnames feature, a few questions for you:

  • I assume configuring the "CDN Host Name" is always required, even if you're also specifying multiple CDN Hostnames, correct? And if so, where does that first hostname get used when you're supplying multiple CDN hostnames in the second box? (The inline docs say the first one listed in the Multiple CDN Hostnames box is used for static resources in the HTML <head> section; so where does the 'primary' hostname listed in the first (required) box get used?) A little clarification here would be helpful so that I can update the inline docs a bit.
  • What do you think about changing the title "Or, Configure Multiple CDN Host Names (for Domain Sharding and Multisite Networks)" to "Multiple CDN Host Names for Domain Sharding (Optional)"? I think that will help clarify that section and bit and remove any confusion for site owners running a Multisite Network where they are not interested in configuring multiple CDN hostnames (i.e., right now it seems to imply that if you're running a Multisite Network, that optional section must be configured if you want to use Static CDN Filters on your Multisite Network).
  • What do you think about moving that entire Multiple CDN Hostnames section into the "Additional Options (For Advanced Users)" area, that way only the required options for configuring Static CDN Filters are presented. Site owners will Multisite Networks will no doubt explore the advanced section if they're interested in configuring multiple CDN Hostnames (a rather advanced feature).
@raamdev raamdev reopened this May 21, 2015
@jaswrks
Copy link

@jaswrks jaswrks commented May 21, 2015

@raamdev writes...

I assume configuring the "CDN Host Name" is always required, even if you're also specifying multiple CDN Hostnames, correct? And if so, where does that first hostname get used when you're supplying multiple CDN hostnames in the second box?

No, the single-line text input field will be emptied and disabled automatically if you have multiple CDN Host Names configured, and/or whenever you type or paste data into the textarea that supports a more advanced configuration.

@raamdev writes...

(The inline docs say the first one listed in the Multiple CDN Hostnames box is used for static resources in the HTML section; so where does the 'primary' hostname listed in the first (required) box get used?) A little clarification here would be helpful so that I can update the inline docs a bit.

The the single-line text input field is not used in that scenario. When you supply a more advanced configuration, your advanced configuration reigns, and the UI reflects this once that is the case. It's a bit confusing (I agree), and it could definitely use some polishing. However, it does become a bit more obvious once you actually use the UI for this, as opposed to just seeing screenshots of it.

@raamdev writes...

What do you think about changing the title "Or, Configure Multiple CDN Host Names (for Domain Sharding and Multisite Networks)" to "Multiple CDN Host Names for Domain Sharding (Optional)"?

That would be absolutely OK with me. That said, I'd suggest that you expose this as being for both purposes; i.e., Domain Sharding and Multisite Networks. If you're running a Multisite Network there are high odds that you will use the more advanced configuration. If not initially, at some point later you are sure to make use of it—if you know about it.

@isaumya writes...

I have a question i.e. as I'm a single owner of my multisite naturally I don't wanna use different CDN for each different site in the network. I wanna use single cdn for all site in my network, as I mentioned earlier. Also as I'm using HTTPS shared URL of maxcdn so I cannot have more than one cdn url.

If you're running a sub-directory installation; i.e., there is only one domain name for all sites in the network, then you can get away with this. Just having a single CDN Host Name is all that is needed.

2015-05-21_14-22-21

Note: this is saying the exact same thing, but in the advanced config. field.

2015-05-21_14-30-25


Multisite Network Config. Recommendations

If you're running multiple domain names (e.g., a domain mapping plugin). Or, if you're using a sub-domain network where each site is on a different sub-domain, you will be required to have a more advanced configuration. One where you clarify for ZenCache; i.e., which CDN(s) go with which domains (or sub-domains).

Example for sub-domain install.

2015-05-21_14-27-07

Example for a network that is running a domain-mapping plugin.

2015-05-21_14-28-29


@raamdev writes...

What do you think about moving that entire Multiple CDN Hostnames section into the "Additional Options (For Advanced Users)" area, that way only the required options for configuring Static CDN Filters are presented.

I think the CDN Host Name, whether it be as a single CDN Host Name, or as a more advanced configuration, should be highly visible. I wouldn't consider either of those to be advanced, any more than setting up Static CDN Filters already is. So in the context of Static CDN Filters, this is a vital component that should be highly visible in my opinion.

I think an improvement to this (i.e., an idea for polishing this up) would be to merge the two of these ideas into one thing (i.e., the single-line input field and advanced configuration textarea). I imagine a slightly more sophisticated UI, where you can click a :plus: icon to add a new mapping.

Only one line would be visible by default, but you could easily add others, and for each one there would be a new line where you specify a comma-delimited list of CDN Host Names that would apply to that domain. In short, the UI would be simple, but it can become complex if you'd like it to be.

@raamdev
Copy link
Contributor

@raamdev raamdev commented May 21, 2015

I'd suggest that you expose this as being for both purposes; i.e., Domain Sharding and Multisite Networks. If you're running a Multisite Network there are high odds that you will use the more advanced configuration. If not initially, at some point later you are sure to make use of it—if you know about it.
[...]
I think the CDN Host Name, whether it be as a single CDN Host Name, or as a more advanced configuration, should be highly visible.

Got it. In that case we should leave it where it is (i.e., not hidden inside the Additional Options dropdown).

I'd suggest that you expose this as being for both purposes; i.e., Domain Sharding and Multisite Networks.

Got it. That makes sense to me now also. I'll change that title to "Multiple CDN Host Names for Domain Sharding and Multisite Networks (Optional)".

the single-line text input field will be emptied and disabled automatically if you have multiple CDN Host Names configured, and/or whenever you type or paste data into the textarea that supports a more advanced configuration.
[...]
I think an improvement to this (i.e., an idea for polishing this up) would be to merge the two of these ideas into one thing (i.e., the single-line input field and advanced configuration textarea). I imagine a slightly more sophisticated UI, where you can click a :plus: icon to add a new mapping.

Yep, that would be the way to go. Right now the interface just isn't intuitive enough to figure out how it works without actually trying to use it; that will inevitably lead to people being afraid to even try it.

For now, I'll write some KB Articles and update the existing Static CDN Filters article(s) using the information that you provided above and then we can link to those from within the interface to help explain what should be done in various scenarios (single-site, multisite sub-directory, multisite sub-domain, multisite + domain mapping). I think that will be a great interim solution until we improve the UI itself (which can probably happen as part of a bigger UI overhaul).

@raamdev raamdev closed this Jun 5, 2015
raamdev added a commit that referenced this issue Jun 5, 2015
**RELEASE CANDIDATE**

- **New Feature!** The free version of ZenCache now supports several new options that were previously only available in the Pro version. You can now toggle the Auto-Clear Cache routines for the Home Page, Posts Page, Author Page, Category Archives, Tag Archives, Custom Term Archives, RSS/RDF/Atom Feeds, and XML Sitemaps. This gives you more control over exactly when ZenCache purges the cache for these parts of your site. See _ZenCache → Plugin Options → Clearing the Cache_ for further details.
- **New Feature!** URI Exclusion Patterns are now available in ZenCache Lite! This previously Pro-only feature is now available in the free version of ZenCache and allows you to exclude a list of URIs from being cached by ZenCache. See _ZenCache → Plugin Options → URI Exclusion Patterns_ for further details.
- **New Feature!** HTTP Referrer Exclusion Patterns are now available in ZenCache Lite! This previously Pro-only feature is now available in the free version of ZenCache and allows you to define a list of referring URLs or domains that send you traffic. When ZenCache sees a request coming from one of those URLs or domains, it will not cache that particular request. See _ZenCache → Plugin Options → HTTP Referrer Exclusion Patterns_ for further details.
- **New Pro Feature!**: HTML Compression now supports compressing JSON (in addition to the already supported HTML, JavaScript, and CSS compression). Props @jaswsinc. See [Issue #469](#469).
- **New Pro Feature!**: Static CDN Filters now supports multiple CDN hostnames. This allows you to configure more than one CDN hostname, also referred to as Domain Sharding. This makes it possible for site owners to work around web browser concurrency limits, allowing the browser to download many resources simultaneously, which increases overall speed. Props to @isaumya and @jaswsinc. See [Issue #468](#468).
- **Enhancement** (Pro): Static CDN Filters now also apply to any static files that are referenced inside CSS files. Props @jaswsinc. See [Issue #461](#461).
- **Enhancement**: Completed a major restructure of the entire codebase to improve modularity and dependency management. Props @jaswsinc.
- **Enhancement** (Pro): Static CDN Filters now supports the ability to configure separate CDN hostname(s) for each domain (or sub-domain) that you run in a WordPress Multisite Network. Props @jaswsinc. See [Issue #475](#475).
- **Enhancement** (Pro): Static CDN Filters now support sub-domains when ZenCache is running inside a WordPress Multisite Network. Props @jaswsinc. See [Issue #439](#439).
- **Bug Fix** (Pro): Static CDN Filters were not being applied to the primary site on WP Multisite installations that used subdomains. (While subdomains are not currently supported by Static CDN Filters, the primary site can still use this feature.) Props to @isaumya for discovering this bug. See [Issue #470](#470).
@raamdev
Copy link
Contributor

@raamdev raamdev commented Jun 9, 2015

ZenCache v150605 (Release Candidate) is now available. This release candidate includes the new multiple CDN hostname support for ZenCache Pro Static CDN Filters.

If you'd like to help with testing this release candidate of ZenCache before the public version is released, please see the link above. If you want to be notified of future release candidate announcements, please sign-up here.

@jaswrks
Copy link

@jaswrks jaswrks commented Jun 9, 2015

Woohoo! It's looking good in my tests so far. I'll keep trying to break it and report back if I find a bug :-)

raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Jun 19, 2015
raamdev added a commit that referenced this issue Jun 27, 2015
- **Restructured Codebase**: The entire ZenCache codebase has been restructured to improve performance, enhance flexibility, and make it easier to build in new features!
- **New Feature!** The free version of ZenCache now supports several new options that were previously only available in the Pro version. You can now toggle the Auto-Clear Cache routines for the Home Page, Posts Page, Author Page, Category Archives, Tag Archives, Custom Term Archives, RSS/RDF/Atom Feeds, and XML Sitemaps. This gives you more control over exactly when ZenCache purges the cache for these parts of your site. See _ZenCache → Plugin Options → Clearing the Cache_ for further details.
- **New Feature!** URI Exclusion Patterns are now available in ZenCache Lite! This previously Pro-only feature is now available in the free version of ZenCache and allows you to exclude a list of URIs from being cached by ZenCache. See _ZenCache → Plugin Options → URI Exclusion Patterns_ for further details.
- **New Feature!** HTTP Referrer Exclusion Patterns are now available in ZenCache Lite! This previously Pro-only feature is now available in the free version of ZenCache and allows you to define a list of referring URLs or domains that send you traffic. When ZenCache sees a request coming from one of those URLs or domains, it will not cache that particular request. See _ZenCache → Plugin Options → HTTP Referrer Exclusion Patterns_ for further details.
- **New Pro Feature!**: HTML Compression now supports compressing JSON (in addition to the already supported HTML, JavaScript, and CSS compression). Props @jaswsinc. See [Issue #469](#469).
- **New Pro Feature!**: Static CDN Filters now supports multiple CDN hostnames. This allows you to configure more than one CDN hostname, also referred to as Domain Sharding. This makes it possible for site owners to work around web browser concurrency limits, allowing the browser to download many resources simultaneously, which increases overall speed. Props to @isaumya and @jaswsinc. See [Issue #468](#468).
- **Enhancement** (Pro): Static CDN Filters now includes proper support for WordPress Multisite Networks, including support for subdomains (full support for Domain Mapping coming in the next release). If you're running a WordPress Multisite Network and want to configure a CDN, see [this KB Article](http://zencache.com/kb-article/static-cdn-filters-for-wordpress-multisite-networks/) for further details.
- **Enhancement** (Pro): Static CDN Filters now also apply to any static files that are referenced inside CSS files. Props @jaswsinc. See [Issue #461](#461).
- **Enhancement**: Completed a major restructure of the entire codebase to improve modularity and dependency management. Props @jaswsinc.
- **Enhancement** (Pro): Static CDN Filters now supports the ability to configure separate CDN hostname(s) for each domain (or subdomain) that you run in a WordPress Multisite Network. Props @jaswsinc. See [Issue #475](#475).
- **Enhancement** (Pro): Static CDN Filters now support subdomains when ZenCache is running inside a WordPress Multisite Network. Props @jaswsinc. See [Issue #439](#439).
- **Bug Fix** (Pro): Static CDN Filters were not being applied to the primary site on WP Multisite installations that used subdomains. Props to @isaumya for discovering this bug. See [Issue #470](#470).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants