Waiting for queue file to be writable slows down admin actions significantly
-
Hi,
On a website with high amount of concurrent edits (e.g. add/edit posts, upload media, etc), I noticed that WP Cloudflare Super Page Cache spends a lot of time sleeping while waiting for the queue file to be writable. Here’s a snippet of the plugin’s debug log file where this is happening:
[2021-09-10 02:48:36] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 171781 and related contents - Fired action: edit_post [2021-09-10 02:48:36] [cache_controller::purge_cache_queue_job] I'm the purge cache cronjob [2021-09-10 02:48:36] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:37] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:38] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:39] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:40] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:41] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:42] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:43] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:44] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:45] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:46] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:47] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:48] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:49] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:50] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second [2021-09-10 02:48:51] [cache_controller::purge_cache_queue_job] Queue file not writable. Sleep 1 second
The consequence of this is that WordPress dashboard appears to be loading for a long time (anywhere between 30 – 60 seconds), as the PHP functions being called by WP CSPC (e.g. purge_cache_queue_write()) is being held up waiting for the queue file to be available.
This isn’t a server performance issue as the server is in fact doing no processing, but the CPU and memory resources remain held up to that PHP process nonetheless, at times leading the server to exhaust its memory.
I would suggest to implement the purge queue in the database instead of using a file on disk. This should allow you to queue multiple cache purge actions without having to wait for the previous item in the queue to complete.
- The topic ‘Waiting for queue file to be writable slows down admin actions significantly’ is closed to new replies.