Support » Plugin: Crowdsignal Polls & Ratings » wp_options autoload causing memory exhaustion

  • One of the sites we maintain is using this plugin, site owner insisted. It has 150k front end user accounts and with just 11 polls spread across 97k posts now we have 177k autoloaded rows in the option table with the option_name “pd-usercode-$user_id” resulting in, at best, an additional 5mb of memory per user per page load. This means we’re spooling up more boxes than we’d really need. There seems to be no reason for the data to be autoloaded as it’s only really used when showing a poll.

    Is there a reason this is autoloaded?
    Is there a reason this isn’t stored in usermeta seeing as it’s user specific?

    The prefered option would be to shift user specific options to usermeta but the simplest solution would be to just set autoload to no for these options:

    
    Index: polldaddy.php
    ===================================================================
    --- polldaddy.php	(revision 1818167)
    +++ polldaddy.php	(working copy)
    @@ -272,7 +272,7 @@
     
     			if ( isset( $this->errors->errors[4] ) ) {
     				//need to get latest usercode
    -				update_option( 'pd-usercode-'.$this->id, '' );
    +				update_option( 'pd-usercode-'.$this->id, '', false );
     				$this->set_api_user_code();
     			}
     	}
    @@ -363,7 +363,7 @@
     			$this->user_code = $polldaddy->get_usercode( $this->id );
     
     			if ( !empty( $this->user_code ) ) {
    -				update_option( 'pd-usercode-'.$this->id, $this->user_code );
    +				update_option( 'pd-usercode-'.$this->id, $this->user_code, false );
     			} elseif ( get_option( 'polldaddy_api_key' ) ) {
     				$this->contact_support_message( 'There was a problem linking your account', $polldaddy->errors );
     			}
    @@ -535,7 +535,7 @@
     				check_admin_referer( 'polldaddy-account' );
     
     				$this->user_code = '';
    -				update_option( 'pd-usercode-'.$this->id, '' );
    +				update_option( 'pd-usercode-'.$this->id, '', false );
     
     				if ( $new_args = $this->management_page_load_signup() )
     					$query_args = array_merge( $query_args, $new_args );
    
    • This topic was modified 1 year, 10 months ago by Spectacula.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Donncha Ó Caoimh

    (@donncha)

    WOW. That’s a huge amount of data loaded. You’re right that those options don’t have to be loaded every time. Can you update your options table and set the autoload field to ‘no’ ?

    I can’t tell you why the options table was used instead of usermeta. It would appear to be the best fit for that data.

    I’ll incorporate your patch and get a new release out. Thank you!

    Thanks,

    We’ll patch our db.

    Thank you so much for fixing this so quickly..

    Turns out I underestimated the amount of data per user coming from the options table. Option table load has gone from 14MB per user to 150KB per user, a slight improvement 😀

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_options autoload causing memory exhaustion’ is closed to new replies.