DescendentCountsMap Performance Issues
(Summing up Joe7's thoughts, after we discussed "his theory 1")
Current state:
- DescendentCountsMap caches the descendent counts per userId.
- That's good for a site with a few registered users and mainly anonymous users, all with the same userId
- Thus if you have many registered users, user X won't profit from the cache entry for user Y
- A site that has high traffic and is mainly used by registered users (this profile matches a lot of community sites) will thus need a few hours until fetchUncachedDecscendentCounts is no longer used by every user for every album (then finally, the cache map table is full)
- But: such a site with a lot of registered is also likely to have a lot of mutations (viewableTreeChange events which delete the cached DescendentCountsMap entries due to permission changes or deleted / new items). Thus, the cache map will be deleted too often.
Noone really profits from the cache and we're constantly doing the expensive non-cached queries.
Bottom line:
- The DescendentCountsMap works good for a site that is mainly used by guest users but it doesn't work if you have very active (uploading new items) / many registered users.
First Improvement - Add caching for groupIds