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.

Comments

DeeLay’s picture

StatusFileSize
new754 bytes

Attached 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.

DeeLay’s picture

StatusFileSize
new764 bytes

There was an issue with the above patch, using array_diff($current_status, $status) instead of $current_status != $status.

sun’s picture

Version: 6.x-1.6 » 6.x-1.16
Status: Active » Needs review
Issue tags: +Performance

Status: Needs review » Needs work

The last submitted patch, only_variable_set_if_changed-1280242-2.patch, failed testing.

sun’s picture

Version: 6.x-1.16 » 6.x-1.x-dev
sun’s picture

Status: Needs work » Needs review
Issue tags: -Performance

Status: Needs review » Needs work
Issue tags: +Performance

The last submitted patch, only_variable_set_if_changed-1280242-2.patch, failed testing.

sun’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new917 bytes

Fixed and re-rolled against 7.x-2.x.

array_diff_assoc() is required here.

sun’s picture

Title: Mollom invalidates variable cache everytime /admin is hit » Variable cache is needlessly invalidated very often
Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Thanks 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.

sun’s picture

Status: Patch (to be ported) » Fixed

Backported, committed, and pushed to 6.x-2.x via #1379136: Backport recent changes in 7.x-2.x.

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 282201b on 7.x-2.x, fai6, 8.x-2.x, fbajs, actions by sun:
    - #1280242 by DeeLay, sun: Fixed Variable cache is needlessly...

  • Commit 282201b on 7.x-2.x, fai6, 8.x-2.x, fbajs, actions by sun:
    - #1280242 by DeeLay, sun: Fixed Variable cache is needlessly...