• Hi,

    I’m trying to optimize my website for performance and have a question about the database cache.

    On my development site, when I run the W3TC setup guide, it indicates memcached as the best choice for database cacheing.

    Normally I get the same result on my production site. But today I was doing some testing and noticed the setup guide is telling me to disable the db cache because both memcached and disk options are much slower. See screenshot below (production site on top, development site below).

    What do you make of this? Any idea why suddenly the database cache is so slow on the production site but not the dev site? Only difference in setup is that the production site has a remote db server while the development site has a local database right on the web server. Production is also using a CDN.

    You think I should just disable db cache on my production site? Seems counter intuitive…

    • This topic was modified 1 year, 4 months ago by Megunticook.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @megunticook

    Thank you for reaching out and I am happy to help!
    This may well be the case with remote DB server. In the initial test, you can see that the time for the PROD site is 5.75ms, and the DEV is the full 2 sec

    Also, the question is if the database is the bottleneck of your website performance, and in some cases, Object Cache?allows you to get data from the database more efficiently. Its purpose is similar to what?a Database Cache?does. But compared to Database Cache,?Object cache?is more efficient as it allows to processing of fewer requests.

    To clarify more, it may look counter intuitive, however, this all depends on the website, server, db etc.

    It does not mean that every setting is good for your website performance.

    This can also be a temporary hiccup on the server or DB server end, so you may want to try and re-do the setup guide and see the results.

    Thanks!

    Thread Starter Megunticook

    (@megunticook)

    Thanks for your feedback on this.

    I redid the setup guide and got a much different result on the database cache:

    So I’ve got this set to Memcached now and the guide indicated that “Disk” was the best choice for the object cache. Will try this for a while and see how it does.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @megunticook

    Thank you for your feedback.
    As you can see, the disk is never a good option for DB caching and in your screenshot you can see that the red percentage increases the response to almost 5s.

    As the setup guide suggests the 4.77ms without any caching and 4.44 with Memcached is not really a big difference.
    As I’ve mentioned before, you may not need DB caching in this case.

    Thanks!

    Thread Starter Megunticook

    (@megunticook)

    Very good, thank you for the helpful information.

    By the way, I was noticing a page on my dev site was loading slowly and discovered an error reported in Chrome’s browser tools involving W3TC. Can you understand what’s going awry here? Here’s what Chrome said:

    {
    "key": "811c3e33c30431a379cb279c7043df5a",
    "type": "warning",
    "message": "fopen(/var/www/html/wp-content/cache/object/634/3ce/6343cefe2efb39ac5b5d4187c4158256.php): Failed to open stream: No such file or directory",
    "file": "wp-content/plugins/w3-total-cache/Cache_File.php",
    "line": 453,
    "stack": [
    "fopen()",
    "W3TC\Cache_File->fopen_write()",
    "W3TC\Cache_File->set()",
    "W3TC\ObjectCache_WpObjectCache_Regular->set()",
    "W3TC\ObjectCache_WpObjectCache->set()",
    "wp_cache_set()",
    "get_option()",
    "WP_Optimize_Options->get_option()",
    "Updraft_Smush_Manager->__construct()",
    "Updraft_Smush_Manager::instance()",
    "Updraft_Smush_Manager()",
    "WP_Optimize->get_task_manager()",
    "WP_Optimize_Premium->__construct()",
    "WP_Optimize_Premium::instance()",
    "WP_Optimize_Premium()",
    "WP_Optimize->plugins_loaded()",
    "do_action('plugins_loaded')"
    ],
    "component": "Plugin: w3-total-cache"
    }
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hey @megunticook

    This is just one of the reasons why you should avoid caching objects to disk.
    Please switch the caching method and delete the /cache/object/ folder manually and let me know if this helps!

    Thanks!

    Thread Starter Megunticook

    (@megunticook)

    Thank you, I set my db caching to memcached.

    When I test my site in GTMetrix, I’m now getting a new message about slow TTB (1.5s). Haven’t seen this before. Any suggestions for how I can pinpoint the cause of this? Do I need to reconfigure my W3TC settings? https://swansislandcompany.com. Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘database cache question’ is closed to new replies.