• Resolved Michael

    (@michael8888)


    We have about 50 plugins. Code Profiler tells me that W3TC requires almost 50% of the CPU resources of all plugins and the theme combined. The execution time of the W3TC plugin is > 1.2 seconds. Cache_File.php (0.9 s) and Util_File.php (0.15 s) are the main culprits.

    What is the reason for this?

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

    (@vmarko)

    Hello @michael8888

    Thank you for reaching out and I am happy to help!
    In some cases, depending on the settings you are using, some settings may cause spikes in the CPU.

    I am not sure which settings you are using, so please note that some settings like Cache preload, especially agresive preload, Statistics, and debuging can consume a lot of resources.

    Disable the settigns and see which one is causing this.

    Thanks!

    Thread Starter Michael

    (@michael8888)

    Marko thanks for the reply!

    Cache preload, statistics, and debuging are off.

    According to Code Profiler the wp_hash function in w3-total-cache/Cache_File.php causes most of the CPU locad.

    You might want to try this yourself.


    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @michael8888

    The wp_hash function is defined at: wp-includes/pluggable.php
    Ands yes it’s used in the W3TC
    Can you please share the configuration of the W3TC and what is the caching method you are using for Page Caching?
    Thanks!

    Thread Starter Michael

    (@michael8888)

    After some investigation, we discovered that the database cache feature was causing the issue. Once we disabled it, the W3TC execution time became reasonable. While the database cache feature may reduce strain on the database system slightly, its negative impact on PHP execution is much greater. With the database cache disabled, the total execution time for a page load decreased by 30-40%.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hellol @michael8888

    Thank you for your feedback.
    In this case, you should keep the DB cacing disabled. Especially if the only caching method available is the Disk based caching.

    I would suggest instaling Redis or Memcached if you want to use DB caching.

    Thanks!

    Thread Starter Michael

    (@michael8888)

    We are using a RAM disk for caching, hence slow storage is unlikely to be the cause of the issue. It appears that the code in Cache_File.php is responsible for the long execution time, with a duration of approximately 1 second. If we disable the database cache, the total execution time of all 50 plugins, including W3TC, is just 0.8 seconds.

    Thread Starter Michael

    (@michael8888)

    Update: We cleaned our database by removing revisions, spam comments, orphaned records, and expired transients. Enabling database cache now only increases execution time by 10%. So, it seems the database size matters.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘W3 Total Cache needs enormous CPU resources’ is closed to new replies.