Scale issue with class.phtocrati_transient_manager.php
-
We recently had a scaling issue with class.photocrati_transient_manager.php.
We use Memcached and have 2000+ blogs. In this configuration, the function _update_tracker() is getting called on every page view. This causes the option ‘phtocrati_cache_tracker’ to be deleted and recreated on every page view. Most of the time, the value is an empty array(). This behavior is causing massive contention with our database.
Due to the frequency this routine is called for users with memcached, it would be best to verify the value has changed before issuing two writes to the database.
Normally, I’d do a pull request.
We have modified the function to look like:
class.photocrati_transient_manager.php: line 45.
## The following function was patched on 2018-04-20. ## At issue, the function did an option delete / option add for every page ## view. This update fixes the function so it only updates the option in ## the DB when the value has been modified (very rare). -- sevatt. function _update_tracker() { global $_wp_using_ext_object_cache; if ($_wp_using_ext_object_cache) { $current_value = get_option('photocrati_cache_tracker', array() ); if ($current_value !== $this->_tracker) { #delete_option('photocrati_cache_tracker'); #add_option('photocrati_cache_tracker', $this->_tracker, '', 'no'); #for WP >= 4.2 you can do this instead update_option('photocrati_cache_tracker', $this->_tracker, 'no'); } } }
The topic ‘Scale issue with class.phtocrati_transient_manager.php’ is closed to new replies.