Problem/Motivation

This was added when we were using the file storage for the active store, so it was worth it.

However, the cache tag is invalidated a lot, so we probably spend more time on recalculating those lists and saving it back into the cache than we benefit, especially with the database backend, that can do a findByPrefix() in a pretty fast way.

Proposed resolution

Remove the persistent cache and the invalidations, keep the static cache, so that repeated requests for the same list are cached (useful for e.g. many repeated entity queries on the same entity type).

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
Related issues: +#2241377: [meta] Profile/rationalise cache tags
FileSize
8.07 KB

Status: Needs review » Needs work

The last submitted patch, 1: remove-cache-listall-caching-2442041-1.patch, failed testing.

Berdir’s picture

Title: Remove listByPrefix() caching » Remove CachedStorage::listAll() caching
Berdir’s picture

Grml.

Berdir’s picture

Hm. I just check the test execution time, and while those used to vary a lot, they actually don't do that anymore, and this is one minute slower:

Patch:
16 min 52 sec

4 different other tests on the same server:
15 min 54 sec
15 min 51 sec
15 min 50 sec
15 min 53 sec

So it would probably be good to figure out why this happens.

olli’s picture

How about keeping the static cache (findByPrefixCache) but drop persistent caching?

Berdir’s picture

Yeah maybe, here's a patch for that, no interdiff I just started fresh.

Status: Needs review » Needs work

The last submitted patch, 9: remove-cache-listall-caching-2442041-9.patch, failed testing.

Berdir’s picture

Will fix the unit test asap.

Performance looks better with this, test run was 16:40, while other runs were 16:57, 17:00 and similar, so slightly faster.

Berdir’s picture

Removing the tests that we no longer need.

Wim Leers’s picture

Status: Needs review » Needs work
Issue tags: +Performance, +D8 cache tags

So basically, this issue is: Remove the configFindByPrefix cache tag (StorageCacheInterface::FIND_BY_PREFIX_CACHE_TAG), because it's now useless.

… because we do exactly that, except for removing StorageCacheInterface::FIND_BY_PREFIX_CACHE_TAG itself. Why not?

If the performance numbers in #11 are correct, then +1. :)

Berdir’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
7.72 KB
1.1 KB

Right, removed that.

The caching isn't *completely* useless, but we're caching a query on an indexed column with a cache get. And it is a cache that is expensive to maintain and often invalidated.

It was a lot more useful when it was caching a glob() on a file system that might have hundreds of files in a single folder.

Wim Leers’s picture

And it is a cache that is expensive to maintain and often invalidated.

+1, especially the latter.

It was a lot more useful when it was caching a glob() on a file system that might have hundreds of files in a single folder.

Indeed.

Question: does this make it impossible for somebody to keep config in the file system and still apply similar caching?

Berdir’s picture

It doesn't make it impossible, you can still write your own implementation and replace it, the new patch keeps the interface so that it can be reset, but I think that is mostly needed for tests anyway.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, that addresses all concerns.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal task that will improve performance and the disruption it introduces is zero. Per https://www.drupal.org/core/beta-changes, this is a good change to complete during the Drupal 8 beta phase. Committed 566bc8b and pushed to 8.0.x. Thanks!

  • alexpott committed 566bc8b on 8.0.x
    Issue #2442041 by Berdir: Remove CachedStorage::listAll() caching
    

Status: Fixed » Closed (fixed)

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