Page MenuHomePhabricator

Dramatically increase cache hit rate for feed
ClosedPublic

Authored by epriestley on Jun 29 2015, 10:16 PM.
Tags
None
Referenced Files
F14058668: D13479.diff
Sun, Nov 17, 1:40 PM
F14058613: D13479.id32627.diff
Sun, Nov 17, 1:20 PM
F14058612: D13479.id32626.diff
Sun, Nov 17, 1:20 PM
F14058600: D13479.id32615.diff
Sun, Nov 17, 1:16 PM
F13980293: D13479.id32626.diff
Oct 19 2024, 9:36 AM
F13976016: D13479.diff
Oct 18 2024, 12:33 PM
F13973416: D13479.diff
Oct 18 2024, 12:50 AM
F13973397: D13479.id.diff
Oct 18 2024, 12:45 AM
Subscribers
Tokens
"Doubloon" token, awarded by btrahan.

Details

Summary

Ref T8631. The query plan for feed stories is really bad right now, because we miss caches we should be hitting:

  • The workspace cache is stored at each query, so adjacent queries can't benefit from the cache (only subqueries). Feed has primarily sibling queries.
    • There is no technical reason to do this. Store the workspace cache on the root query, so sibling queries can hit it.
  • In ObjectQuery, we check the workspace once, then load all the PHIDs. When the PHIDs are a mixture of transactions and objects, we always miss the workspace and load the objects twice.
    • Instead, check the workspace after loading each type of object.
  • HandleQuery does not set itself as the parent query for ObjectQuery, so handles never hit the workspace cache.
    • Pass it, so they can hit the workspace cache.
  • Feed's weird PhabricatorFeedStory::loadAllFromRows() method does not specify a parent query on its object/handle queries.
    • Just declare the object query to be the "root" query until this eventually gets cleaned up.
Test Plan

Saw queries for each object drop from 4-6x to 1x in /feed/.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Dramatically increase cache hit rate for feed.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
  • Make sure omnipotent and public users can never share the same cache bucket.
  • Also use cache fragments in NamespaceQuery.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Jun 30 2015, 6:10 PM
This revision was automatically updated to reflect the committed changes.