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.
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%.
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.