We were seeing a large amount of "SELECT * FROM variable" queries stacking up in the database. The investigation traced it back to mollom.
Specifically the _mollom_status function, which is doing a variable_set any time hook_requirements is invoked. It may not seem like a big deal, but big sites running Drupal tend to be quite dependant on cache, so anything that repeatedly invalidates a cache can cause issues during at high traffic times.
Every time anyone hits /admin, system invokes hook_requirements, mollom calls _mollom_status forcing it to reset, leading to the variable_set. Given the number of editors, customer services reps, production staff, moderation team, etc accessing the administration pages we were seeing 1000s of variable cache rebuilds.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | mollom.status.8.patch | 917 bytes | sun |
| #2 | only_variable_set_if_changed-1280242-2.patch | 764 bytes | DeeLay |
| #1 | only_variable_set_if_changed-1280242-1.patch | 754 bytes | DeeLay |
Comments
Comment #1
DeeLay commentedAttached is the patch that we are running on the economist.com to get around this problem, essentially we check to see if the status has changed before doing a variable_set.
Comment #2
DeeLay commentedThere was an issue with the above patch, using array_diff($current_status, $status) instead of $current_status != $status.
Comment #3
sunComment #5
sunComment #6
sun#2: only_variable_set_if_changed-1280242-2.patch queued for re-testing.
Comment #9
sunFixed and re-rolled against 7.x-2.x.
array_diff_assoc() is required here.
Comment #10
sunThanks for reporting, reviewing, and testing! Committed to 7.x-2.x and 7.x-1.x.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
Will be merged into 6.x-2.x and 6.x-1.x in shortly.
Comment #11
sunBackported, committed, and pushed to 6.x-2.x via #1379136: Backport recent changes in 7.x-2.x.