Project

General

Profile

Actions

Bug #18098

closed

Disable NextGen Gallery's cache tracker

Added by Raymond Hoh about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Performance
Target version:
Start date:
2023-04-21
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

While looking into our database storage issue (#17761), I've identified NextGen Gallery as a probable offender of our storage woes. I started logging new additions as well as new updates to the DB to one of our sites using NextGen (site ID 13027) and found that the log was 99.5% full with a NextGen DB option called 'photocrati_cache_tracker'. (For Jeremy or Boone, you can view the log at /PROD_WWW/html/commons/www/wp-content/uploads/ray-db-debug.log). The other 0.5% was from the 'akismet_spam_count' option (15 times) and the 'post_count' option (1 time). Since April 21, 1pm UTC until now (roughly April 22, 2am UTC), update_option( 'photocrati_cache_tracker' ) was called 3266 times.

The other problem other than the update frequency is the size of the 'photocrati_cache_tracker' option. That option currently sits at 7.32MB:

mysql> select char_length(option_value)/1024/1024 from wp_13027_options where option_name = 'photocrati_cache_tracker';
+-------------------------------------+
| char_length(option_value)/1024/1024 |
+-------------------------------------+
|                          7.31606674 |
+-------------------------------------+
1 row in set (0.03 sec)

Since InnoDB stores every type of transaction (a good readthrough is this PDF), I think it is safe to assume the 'photocrati_cache_tracker' option is the main culprit behind most of our storage problems (other than StatPress!).

So the next thing we need to figure out is what the 'photocrati_cache_tracker' option does. A thread on wordpress.org ran into the same problem as us: https://wordpress.org/support/topic/what-does-photocrati_cache_tracker-do/. One of the NextGen devs chimed in and mentioned that this option tracks all NextGen transients so they can purge the transients in groups when running an object cache. My first thought is this shouldn't be necessary since WordPress deletes expired transients on its own, but I digress! The dev fortunately decided to let site administrators disable this tracker through the 'NGG_DISABLE_PHOTOCRATI_CACHE_TRACKER' constant: https://github.com/cuny-academic-commons/cac/blob/34a3a64d76ed2291289d25c780dcbd13cf472952/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_transient_manager.php#L35-L36

I think our next steps are to:
1. Set the following line somewhere: define( 'NGG_DISABLE_PHOTOCRATI_CACHE_TRACKER', true );
2. Wipe out the 'photocrati_cache_tracker' option for all NextGen Gallery sites for performance reasons
3. Probably think about disabling the cronjob for NextGen Gallery as well with the following line: define( 'NGG_CRON_ENABLED', false );. See https://github.com/cuny-academic-commons/cac/blob/34a3a64d76ed2291289d25c780dcbd13cf472952/wp-content/plugins/nextgen-gallery/nggallery.php#L434-L439


Related issues

Related to CUNY Academic Commons - Bug #18016: ml-slider get_plugins() call causes performance issuesHoldBoone Gorges2023-04-12

Actions
Actions

Also available in: Atom PDF