• Resolved kerwan

    (@kerwan)


    Hi,

    We have our wordpress website running on WordPress 5.2.5 and W3TC 0.12.
    The Website is running on a Kubernetes infrastructure, currently, the cache is not persisted and not shared between instances. In resume, when we deploy a new version or simply create a new instance, the cache folder does not exist (or is empty).

    The problem here is that we are not able to access to website pages except the homepage and we get 404 (returned directly by Apache).

    We can solve the problem by going to “Admin > Pages” then clicking on a random page.
    By doing that, every pages are now accessible.

    Our configuration:
    – Page Cache
    – Database Cache
    – Object Cache

    With “define(‘WP_CACHE’, true); define(‘W3TC_CONFIG_DATABASE’, true); define( ‘W3TC_CONFIG_DATABASE_TABLE’, ‘wp_options’ )” in “wp-config.php”

    How can we solve this problem, currently, it’s a pain to autoscale our infrastructure and manage our automatic deployments.

    Thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @kerwan

    I am sorry about the issue you are experiencing and I am happy to help.
    Using both DB cache and object Cache is not recommended especially when on shared hosting.
    Using disk-database caching (on shared hosting) can make your site slower. This is so because getting data from the database can be faster than getting cached data from the disk.
    Object Cache allows getting data from the database more efficiently. Its purpose is similar to what Database Cache does. But compared to Database Cache, Object cache is more efficient as it allows to process fewer requests.
    Like Database Cache, it can be beneficial to use if you are on VPS or dedicated server, get a lot of traffic, have a lot of comments. Also, if you know that database is the bottleneck of your website performance, then Object Cache (like Database Cache) is beneficial to use. But in this case, it’s recommended to use Opcode, Memcached or Redis options
    Thank yoU!

    Thread Starter kerwan

    (@kerwan)

    Hi and thanks for this perfectly detailed answer !

    In resume, what would be the ideal configuration to fit our infrastructure ?
    – Page Cache – Yes (Disk) (With shared cache folder ?)
    – Database Cache – No
    – Object Cache – Yes (Which engine ?)

    It’s an eCommerce Website with ~200 concurrent users, our database can handle a lot of requests (we only use <10% of the CPU).

    The website is running on Kubernetes and we have ~4 instances running at the same time.

    Thanks in advance !

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @kerwan

    You should consider using a memory-based caching method for both Page Cache and Object Cache.
    Memcached or Redis, W3 Total Cache supports both. Just make sure to install a PHP extension for Redis or Memcached and restart your server for the options to be available.
    Thank you!

    Thread Starter kerwan

    (@kerwan)

    I’ve been able to setup a Memcached on W3TC hosted on AWS Elastiscache.
    I found what was the culprit for our 404 pages (auto rewriting of .htaccess).

    An other problem happen now we are using Memcached.
    On some pages (such as Products Page) do not show the same content (same price) to each users. So, we cannot enable Page Cache on theses pages.

    But as you can see here : https://imgur.com/a/WJcChWw
    Without Page caching, we have a huge amount of requests to the Memcached server which results in a high I/O latency (1.13s).

    Here is an example of a page with Page Caching : https://imgur.com/a/pWQp8Nc
    As you can see, there is only 2 requests to the Memcached server in a total of 5ms of I/O.

    Is there any solutions for pages that do not use Page Cache and need to run a lot of database queries ?
    Maybe I should continue to use “Disk” for Object Caching ?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @kerwan

    You should try and see which option suits you better.
    You can also disable PAge cache for logged in users or specific user roles in Performance>Page Cache>General. This may help you to have those pages cached but logged in users if that is the cause of the price difference.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error 404 on pages when empty cache (Excepte home)’ is closed to new replies.