WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
CDN in a clustered environment (9 posts)

  1. aelfred
    Member
    Posted 1 year ago #

    I'm new to WordPress and am setting up a WordPress site that will run on a number of Windows Servers behind a load balancer.

    W3 Total Cache was recommended to me and, on the whole, it seems to be working very well in particular the CDN options. However I have a problem with the admin site. As I understand it the WordPress admin site will not use the CDN to pull in the images but will use the local uploads folder. And so, dependant on which server the admin user hits , the image for a post may or may not be visible in the admin interface.

    So am I missing some option that will enable each server to either use the CDN images in the admin interface or to have the servers pulling the images locally?

    Thanks in advance for any assistance.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Anthony Somerset
    Member
    Posted 1 year ago #

    You need to really make sure your uploads folder is replicated over your cluster, in linux GlusterFS would be a good candidate to achieve this (or NFS)

    in windows, a standard windows share might do the trick for the uploads folder, that way all servers get access to all the same upload files - i'm not sure how that will handle from a performance perspective though for you and your traffic

  3. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    @aelfred, was what @Anthony Somerset said, helpful?

  4. aelfred
    Member
    Posted 1 year ago #

    Hi,

    I have gone down the replication route and am using TntDrive to map my Amazon S3 storage as a drive on all the windows servers in the cluster.

    As Anthony points out performance is a concern here and I'm looking into this now...

    Thanks for the responses,

    Aelfred

  5. TheBlakePetersen
    Member
    Posted 1 year ago #

    We have a load-balanced set up where we have the Origin server, where we make adjustments to the templates and w3tc config file, that lsyncs out to our collection of Node servers.

    When an admin hits the site, they could be coming to any one of our servers, and may jump to another node during the same session. We can't force the admins to the Origin and so when they upload an image in the backend, the file is uploaded to the CDN and shows fine on the front-end, but the backend won't show the images unless the user happens to have made the change to the Origin server and the files were pushed out to the Nodes (which is only 8% of the time).

    Since we can't force the uploads to go to the origin, there's no guarantee the files will make it to the origin and sync out to the Nodes, and broken images abound.

    Is there a way we can force images in the backend to use the CDN or is there a way to force image uploads to a specific IP?

    Thanks so much, and AMAZING PLUGIN FREDERICK! Can't believe how easily the CDN setup was, even having to manually set up the config file for each site on our origin server due to the whole node/lsync issue.

  6. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    @TheBlakePetersen, consider using an NFS or similar to address that issue. There are numerous ways to do so in a performant manner. Then go ahead and use an origin pull CDN provider.

  7. TheBlakePetersen
    Member
    Posted 1 year ago #

    We took a much less elegant route, we just added a jQ snippet to swap the images' references with the CDN container reference. Easy peasy.

  8. gregpymm
    Member
    Posted 1 year ago #

    Hi blake, can you explain your jQ snippet solution a little more? Thanks!

    It sounds like a good solution for me!

  9. gregpymm
    Member
    Posted 1 year ago #

    I actually solved it with a RedirectMatch in an .htaccess file .

    RedirectMatch ^/wp-content/uploads/(.*) http://cdn_domain_name.com/wp-content/uploads/$1

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic