Uploaded image for project: 'Archive of Our Own'
  1. Archive of Our Own
  2. AO3-4858

Batch tag count updates to speed up posting

    Details

    • Type: Improvement
    • Status: Deployed
    • Priority: High
    • Resolution: Done
    • Affects Version/s: 0.9.179
    • Fix Version/s: 0.9.187
    • Milestone:
      Internal 0.9
    • Difficulty:
      Hard
    • Roadmap:
      Work
    • Components:
      BackEnd

      Description

      Current when under high load the systems takes a long time to post new works, this is really only apparent when multiple people are posting works which share the same tag.

      Currently posting takes a long time as the following query takes around 2 minutes:

      UPDATE `tags` SET `taggings_count` = COALESCE(`taggings_count`, 0) + 1 WHERE `tags`.`type` IN ('Rating') AND `tags`.`id` = 11

      So my plan is to remove taggings_count as a field in the db and make it a method with some smart caching.

      Testing notes:

      • Tags with less than 999 uses are small and should not be cached
      • Tags with 1,000-39,999 uses are medium and should be cached for a variable period of time (3-40 minutes)
      • Tags with 40,000 uses or more are large and should be cached for 30 minutes

      You will want to find a tag in each of these categories, and then go to the edit page for that tag (http://test.archiveofourown.org/tags/Tag%A/edit) before you post. Note the number listed in "Taggings Count (#)" in the sidebar.

      Now post the work.

      Then reload the edit page. The "Taggings Count (#)" should change immediately for the small tag, but it should not change for the medium and large tags until the caching period (3-40 minutes) is up.

      Also check that you can access the pages linked in the sidebar on http://test.archiveofourown.org/tag_wranglings:

      On each of those pages, make sure you can sort tags by their taggings count. Click the "↓ Taggings" link at the top of the table (between the Canonical and Manage columns) to sort.

        Attachments

          Activity

            People

            • Assignee:
              zz9pzza2 james_
              Reporter:
              zz9pzza2 james_
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: