Customize Preload Parameters

Starting from WP Rocket 3.12 you can tweak some parameters of the Preload feature, this will help to reduce the CPU usage in those cases where it is caused by this optimization.

We have three filters to achieve this:

  • Batch Size: rocket_preload_cache_pending_jobs_cron_rows_count 

    It's the number of URLs that will be processed on each run. 45 is the default. Setting a lower value can help the server to work on fewer requests at a time.
  • Interval between batches: rocket_preload_pending_jobs_cron_interval 

    It is the pause that will be applied between processing of batches. By setting a higher value (default is 60 seconds), the server will have more time to rest between processing batches.
  • Delay between requests: rocket_preload_delay_between_requests 

    This is the delay between requests. Setting a higher value will space the requests and reduce CPU usage. The default is 0.5 seconds (500000 microseconds).

You can use this helper plugin to achieve it:

📥 Download (.zip): WP Rocket | Change Preload Parameters

Developers: You can find the code for this plugin on GitHub.

Important! You must edit the helper plugin before use!

Only install this plugin if you are comfortable editing files via (S)FTP! This plugin itself works; however, in case something conflicts in your custom environment, you might need to remove this plugin manually via (S)FTP.

Instructions to use this helper plugin

  1. In the helper, the values are already changed so you can install it as it is. Or you can set your custom values by editing:
    • Line 28, to set the batch size. It is the number of URLs that will be processed on each run. The default is 45, the helper will set this to 30.
    • Line 45, to set the desired cron interval in seconds. It is the pause that will be applied between the processing of batches. The default is 60 seconds, the helper will set it to 120 seconds.
    • Line 63, to change the delay between requests made to the same URL. The default is 0.5 seconds (500000 microseconds). Use a value in seconds.
  2. Compress it as ZIP, upload and activate the helper plugin.
  3. Changes will be applied the next time the Preload runs.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.