Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


use W3 total Cache if Nginx is Reverse proxy?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

use W3 total Cache if Nginx is Reverse proxy?

if I'm using nginx in hosting mode, apache in default mode, I presume this setup means nginx is a reverse proxy, it is maintaining a cache. for my WordPress installations... Should I be using caching plugins like W3 total Cache or other?

Would it be beneficial or just waste of resources ?

Comments

  • jcalebjcaleb Member
    edited September 2014

    If content is fairly static. NGINX cache is excellent

  • Static is served good by nginx but wp-super-cache type plugins will make the phppages faster. If you are running nginx in front of apache i think you can give that a try. And also Use Jetpacks "Photon". It is good.

  • said: Should I be using caching plugins like W3 total Cache or other?

    No, PHP is extremely slow and shouldn't be used for caching (unless the content can't be normally cached). Hopefully with caching on the web server you wont need to to hit PHP.

  • @Silvenga said:
    No, PHP is extremely slow and shouldn't be used for caching (unless the content can't be normally cached). Hopefully with caching on the web server you wont need to to hit PHP.

    If no caching than the static page generation will be much slower since its WordPress so caching is still needed. Put the database+object to the RAM using APC or Memcached to speedup the static page generation by W3 Total Cache or WP Super Cache.

  • edan said: If no caching than the static page generation will be much slower since its WordPress so caching is still needed.

    PHP is going to be the bottleneck here. The best thing is to avoid it. If we cache static pages then we won't need to hit PHP. 100% of anonymous hits will hit the cache - no need to optimise the lower levels and consume resources.

  • jarjar Patron Provider, Top Host, Veteran

    @edan said:
    If no caching than the static page generation will be much slower since its WordPress so caching is still needed. Put the database+object to the RAM using APC or Memcached to speedup the static page generation by W3 Total Cache or WP Super Cache.

    Anyone who uses database and object caching in W3 without extensive knowledge of how to master a memcached configuration deserves the performance issues that follow. In almost all cases this is a opt-in performance problem and an unnecessary overhead.

    Simply cache the content as static html and use mod_rewrite to serve it as such.

    Thanked by 2obakfahad Amitz
  • @Jar said:
    Simply cache the content as static html and use mod_rewrite to serve it as such.

    I use that and it works like sunrise. :)

    Thanked by 1jar
  • @Jar said:
    Simply cache the content as static html and use mod_rewrite to serve it as such.

    For simple and low traffic sites its overkill indeed but for complicated blog and huge traffic than generating the static files without proper caching it can kill the sites :)

  • I run a WordPress site for work that gets a few million hits per day. I have nginx proxying to Apache as you've described. Because we get frequent comments, we couldn't just rely on nginx to cache; we're using both nginx and W3TC. W3TC caches to memcached, and nginx first attempts to read from memcached before hitting Apache (note: I had to update W3TC a bit for the cache key to be formatted as needed). W3TC invalidates and regenerates the page cache with each comment, so this works out nicely.

    Solely relying on the nginx cache means that users will have to wait TTL seconds before they can see any new comments, unless you're not caching logged-in users, which can put a lot of load on your site. If the bulk of your users are anonymous, then this would probably work just fine, though.

  • Use the nginx helper plugin:

    https://wordpress.org/plugins/nginx-helper/

    The above together with nginx's built in caching system is all you need.

  • amhoab said: Solely relying on the nginx cache means that users will have to wait TTL seconds before they can see any new comments

    Varnish 4.0 fixes that - async content update checking. :P

  • Well,
    Thanks for the education... I'm enlightened.
    All in all, I feel my presumption was right NOT to go PHP side caching with plugins, as my site (for the moment) is just around a 1500/2000 hits a day mark. But I guess once it starts taking a viewer surge, I will go by the super suggestions.

    About the Nginx helper and other setups suggested, please help me understand what precisely would help my setup:

    ubuntu 14.04 64bit on a 4gb VPS
    using VestaCP -

    • Hosting Template for this WP4.0 site is Nginx set to hosting, apache to default
    • replaced MySql with MariaDB

    please suggest if anything needs to be reconfigured which can yield better performance, secondly what plugins or setup will give a good performance boost.

    thanks alot

  • Silvenga said: Varnish 4.0 fixes that - async content update checking. :P

    Not exactly. That feature prevents you from having to wait for the backend response, and serve directly from cache. It still only reaches to the backend once per TTL. It's an awesome feature, but not really applicable here. I use it on a site where it takes a few seconds to generate a page, and Varnish masks that slowness.

  • SilvengaSilvenga Member
    edited September 2014

    amhoab said: Not exactly.

    I've got to test that. I have Varnish caching an Apache server. I'm having Apache add the correct caching headers (etags, expires, etc.) before hitting Varnish. When I update the JS, I just have to request the file again (after clearing the browser cache) for the new content. Varnish is reporting the cache hit on these requests.

    amhoab said: but not really applicable here

    This could be useful for the dynamic stuff. The update isn't immediate, but it might be fast enough for the OP's domain. Either way users are hitting Varnish 100% of the time (faster than PHP).

  • mehargags said:

    ubuntu 14.04 64bit on a 4gb VPS using VestaCP - - Hosting Template for this WP4.0 site is Nginx set to hosting, apache to default - replaced MySql with MariaDB

    please suggest if anything needs to be reconfigured which can yield better performance, secondly what plugins or setup will give a good performance boost.

    thanks alot

    Is there a reason why you are using apache at all? Nginx can serve php pages perfectly well with php-fpm. Take apache out of the equation.

  • Symlink,
    I would want to, but given the time required to configure everything by hand, and then someday hitting a roadblock because of not using Apache fears me. I can spend some weeks to setup my server once, but can't put time into it every now and then.

    Thats why, I use VestaCP, and as per my extensive reading, Vesta cannot run nGinx only. (correct me if I'm wrong)

    And yes, I can't get rid of Control panel, I have teams to operate projects, who only know basic of hosting and not managing server.

    thats exactly why I don't went Varnish route, I wanted to have a SAFE config down the road which is full backward compatible for the next 2 years. Though after sometime, apache may or may not be seen used!

  • NGINX cache is my first choice

Sign In or Register to comment.