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 );
- The topic ‘wp_options autoload causing memory exhaustion’ is closed to new replies.