WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
[resolved] Only home page Super Cached the rest always from WP Cache. (6 posts)

  1. RavanH
    Member
    Posted 2 years ago #

    Hi Donncha et al.

    Running WP Super Cache in PHP mode (and all recommended settings) on a Network installation, hosted on an Nginx server, I notice that only the home pages of each site in the network actually get an entry in the supercache cache directory. All others get a dir but it remains empty.

    Looking at the timestamps (when visiting my site in an anonymous session browser, refreshing the pages with Ctrl+R) I see that the homepage timestamps remain constant on the homepages but anywhere else, the timestamps differ on each refresh.

    I enabled Debug mode and visited such a page (/over/) where timestamps differ and get this output:

    21:03:45 /over/ supercache dir: /var/www/wordpress/wp-content/cache/supercache/4visions.nl/over/
    21:03:45 /over/ No wp-cache file exists. Must generate a new one.
    21:03:45 /over/ In WP Cache Phase 2
    21:03:45 /over/ Setting up WordPress actions
    21:03:45 /over/ Supercache caching disabled. Only using wp-cache. Non empty GET request.
    21:03:45 /over/ Created output buffer
    21:03:45 /over/ Output buffer callback
    21:03:45 /over/ Supercache disabled: GET or feed detected or disabled by config.
    21:03:45 /over/ Gzipping buffer.
    21:03:45 /over/ Writing gzipped buffer to wp-cache cache file.
    21:03:45 /over/ Renamed temp wp-cache file to /var/www/wordpress/wp-content/cache/wp-cache-4visions.nl442844a01da748070e6561d6d0563d8e.html
    21:03:45 /over/ Writing gzip content headers. Sending buffer to browser
    21:03:45 /over/ wp_cache_shutdown_callback: collecting meta data.
    21:03:45 /over/ Writing meta file: /var/www/wordpress/wp-content/cache/meta/wp-cache-4visions.nl442844a01da748070e6561d6d0563d8e.meta

    and then on reload the exact same output:

    21:04:37 /over/ supercache dir: /var/www/wordpress/wp-content/cache/supercache/4visions.nl/over/
    21:04:37 /over/ No wp-cache file exists. Must generate a new one.
    21:04:37 /over/ In WP Cache Phase 2
    21:04:37 /over/ Setting up WordPress actions
    21:04:37 /over/ Supercache caching disabled. Only using wp-cache. Non empty GET request.
    21:04:37 /over/ Created output buffer
    21:04:38 /over/ Output buffer callback
    21:04:38 /over/ Supercache disabled: GET or feed detected or disabled by config.
    21:04:38 /over/ Gzipping buffer.
    21:04:38 /over/ Writing gzipped buffer to wp-cache cache file.
    21:04:38 /over/ Renamed temp wp-cache file to /var/www/wordpress/wp-content/cache/wp-cache-4visions.nl442844a01da748070e6561d6d0563d8e.html
    21:04:38 /over/ Writing gzip content headers. Sending buffer to browser
    21:04:38 /over/ wp_cache_shutdown_callback: collecting meta data.
    21:04:38 /over/ Writing meta file: /var/www/wordpress/wp-content/cache/meta/wp-cache-4visions.nl442844a01da748070e6561d6d0563d8e.meta

    Two things I notice:
    1. The same meta file gets rewritten each time (server timestamps change)
    2. The log says: "Non empty GET request." which is not true.

    What could be causing this?

    Other log entries I notice seem to be failed (I see not even a super cache dir created) attempts to cache static files:

    21:04:38 /files/2012/07/header-image.jpg supercache dir: /var/www/wordpress/wp-content/cache/supercache/4visions.nl/files/2012/07/header-image.jpg/
    21:04:38 /files/2012/07/header-image.jpg No wp-cache file exists. Must generate a new one.

    Any reason why that would be necessary? Is Super Cache in PHP mode faster than ms-files.php?

    Thanks for your help / clarification on this :)

    Kind regards,
    Allard

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    There's something in your Nginx rules. I have seen this happen before but I don't know how to fix it as I don't use Nginx. I would dump $_GET to a file and see what's in it and look in your Nginx config or on Google as there might be something .

  3. RavanH
    Member
    Posted 2 years ago #

    Ok, I'll look further into this GET thing that seems to be going on.

    On another (or maybe related) note, I've had two major outages in one day since I installed WP Super Cache. Each time just restarting the php5-fpm service will get the thing back up as Nginx and the SQL server remain unaffected. Nothing in the php log. Nothing in the slow log. Nothing in the nginx error log. Very weird.

  4. RavanH
    Member
    Posted 2 years ago #

    Yes, you are right. Dumping the GET variables for that same page, I see:

    Array
    (
        [q] => over/
    )

    which led me to the following Nginx rule (in /etc/nginx/sites-enabled/default):

    # Send everything else to index.php (permalinks)
    rewrite ^/(.*)$ /index.php?q=$1 last;

    which I changed to:

    # Send everything else to index.php (permalinks)
    # Dropped ?q=$1 for WP Super Cache compat (don't use get vars)
    rewrite ^/(.*)$ /index.php last;

    and now all pages are cached! Thanks for pointing me in the right direction :)

    About the PHP lockups, would you advise me to enable Debug for all IP's and wait for the next crash? Or is that too blunt a method?

  5. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for leaving a comment on my post on the topic too. I think I had the same crashes you saw when I tried Nginx and I don't know what causes it but if cached files are served rather than talking to PHP it should be a lot more stable.

    I doubt the plugin debug would help with the crashes but the PHP error log might have an error in it.

  6. RavanH
    Member
    Posted 2 years ago #

    It is strange, there are no errors logged by PHP around the time the service went down. And in the slow.log I see the last slow trace long before the crash:

    Jul 05 05:15:50.489933 [pool www] pid 16509
    script_filename = /var/www/wordpress/wp-cron.php
    [0x000000000189c7b8] sleep() /var/www/wordpress/wp-content/plugins/wp-super-cache/wp-cache.php:2856
    [0x00007fff6ef2ce70] wp_cron_preload_cache() unknown:0
    [0x000000000189be10] call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:484
    [0x000000000189b238] do_action_ref_array() /var/www/wordpress/wp-cron.php:92

    Followed by the first one right after restarting the php5-fpm service:

    Jul 05 12:25:31.432878 [pool www] pid 18868
    script_filename = /var/www/wordpress/wp-cron.php
    [0x00007f1701b36298] curl_exec() /var/www/wordpress/wp-includes/class-http.php:1154
    [0x00007f1701b35e28] request() /var/www/wordpress/wp-includes/class-http.php:254
    [0x00007f1701b34370] _dispatch_request() /var/www/wordpress/wp-includes/class-http.php:191
    [0x00007f1701b34190] request() /var/www/wordpress/wp-includes/class-http.php:297
    [0x00007f1701b34010] get() /var/www/wordpress/wp-includes/http.php:76
    [0x00007f1701b305e8] wp_remote_get() /var/www/wordpress/wp-content/plugins/wp-super-cache/wp-cache.php:2854
    [0x00007fff5aae8030] wp_cron_preload_cache() unknown:0
    [0x00007f1701b2fc40] call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:484
    [0x00007f1701b2f068] do_action_ref_array() /var/www/wordpress/wp-cron.php:92

    Nothing else...

    What I did notice during the last crash was that the site still showed several browser cached elements. Would the server have to have responded with a 304 for those elements? And if so, Super Cache in PHP mode needs to have at least some PHP live to responds like that, right? Could this indicate the service is not really down but failing on another level? But then, why no error logs? It's a mystery to me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic