• Resolved aaron843

    (@aaron843)


    Is there a way to throttle back CPU usage while crawling the site? Can we set a delay or number of pages/time?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter aaron843

    (@aaron843)

    Does this still work? I tried setting it to 5 minutes, and CPU is still hitting 87%. I’m getting emailed warning from the server every few minutes.

    add_filter( 'wpoptimize_preload_delay', function( $original_delay ) {
        return 300000000; // Delay in microseconds, 1000000 = 1s
    } );
    Plugin Support vupdraft

    (@vupdraft)

    There are several parameters you can play with:
    – Using;

    add_filter(‘wpoptimize_preload_delay’, ‘my_preload_delay_method’),

    you can override the delay between two pages, which is currently set at 500000 (1/2 a second).

    – Using;

    add_filter(‘wpo_page_cache_preload_memory_threshold’, 10485760);


    This filter lets you change how much memory should be left before interrupting the preload queue (10MB by default).

    – Using;

    add_filter(‘wpo_page_cache_preload_continue_interval’, 600);


    This filter enables to change the time before the preload resumes when interrupted (600s by Default).

    Thread Starter aaron843

    (@aaron843)

    Is that the complete code? I get the following error when I try what you wrote:

    Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given
    • This reply was modified 1 year, 6 months ago by aaron843.
    Plugin Contributor Venkat Raj

    (@webulous)

    @aaron843 You can’t supply a numeric value to add_filter call. It should be

    add_filter('wpo_page_cache_preload_continue_interval', function($interval) {
      return 1200;
    });
    
    add_filter('wpo_page_cache_preload_memory_threshold', function($threshold) {
      $new_threshold = 1234; // you desired number
      return $new_threshold;
    });
    Thread Starter aaron843

    (@aaron843)

    Thanks I’ve tried a delay of 5 minutes. It seems there are still 5 or 6 processes that launch immediately. So I don’t know if it’s using the settings.

    I set both wpo_page_cache_preload_continue_interval and wpoptimize_preload_delay to 300000000. This resulted in the creation of about 1.6 new cache files per minute over a period of 45 minutes. Server CPU loads are around 35%-70%. But I’m still getting warning emails that the CPU is hitting as much as 90% usage (normally it’s under 10% but hard to verify if this is all from cache building.)

    I’ll continue to experiment to see what these values result in.

    • This reply was modified 1 year, 6 months ago by aaron843.
    • This reply was modified 1 year, 6 months ago by aaron843.
    • This reply was modified 1 year, 6 months ago by aaron843.
    • This reply was modified 1 year, 6 months ago by aaron843.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Reduce CPU usage?’ is closed to new replies.