This is a work in progress, just posting this so I don't forget about it (again).

The idea is to add a status page with some statistics and also specific information about render cache entries.

It is not finished but I'd love some feedback on running this on larger data sets, to see how long it takes to process 100k or more cache entries.

Will likely move the slow part to a separate page.

EDIT: Related module: Redis Info.

Comments

Berdir created an issue. See original summary.

o'briat’s picture

It works on my dev environment, I'll try it later on a staging one.

Some minor remarks :

the redis.info.yml referers to an undefined route :

configure: redis.admin_display

This should be change to redis.report.

A link to this page should be added to the hook_help() and hook_requirements() (is this one should be placed into the module file instead of the install file?).

Don't forget to add the prefix key.

I'll also try to add some additional information about sentinel mode.

berdir’s picture

Status: Active » Needs work
berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new9.36 KB

Here's a new version of the patch with some improvements.

wim leers’s picture

Nice! :)

+++ b/src/Cache/PhpRedis.php
@@ -63,7 +63,9 @@ class PhpRedis extends CacheBase {
+      //$pipe = $this->client->multi(\RedisCluster::PIPELINE);

Eh :)

berdir’s picture

StatusFileSize
new8.68 KB
new688 bytes

Yeah, forgot to remove that.

o'briat’s picture

Hi, I test this patch, I just found an error if no client is configured. So I had a test on it and display the same message that found in redis_requirements.
I also made some php code sniffer linting.

Page OK :
statistics

No client :
no client

grimreaper’s picture

Hello all,

Thanks for the patches. I am currently testing it.

I have a feedback to give.

Maybe for the "Keys per cache bin" info, an alphabetical sort would be better than a sort based on the number of results.

So the cache bins would always be in the same order no matter the number of keys.

grimreaper’s picture

Hello,

To not forget, I already said it IRL to @O'Briat.

It would be nice to have a link on a Redis documentation page on how to configure the memory handling. For the row "Memory" When it is in warning.

Thanks.

o'briat’s picture

Hi,

I'll provide a patch, here's an overview :


      $redis_url = Url::fromUri(
        'https://redis.io/topics/lru-cache',
          [
            'fragment' => 'eviction-policies',
            'attributes' => [
              'target' => '_blank',
            ],
          ]
      );
      $requirements['memory']['description'] = $this->t(
        'It is recommended to configure the maxmemory policy to e.g. volatile-lru, @see.',
        ['@see' => Link::fromTextAndUrl('see Redis documentation', $redis_url)->toString()]
      );

Also about the message "No cache tags found, make sure that the redis cache tag checksum service is used.", a precision could be added: " or you're not using developing settings." :)

One last thought : should the content of the readme.md be copied to the help page ?

o'briat’s picture

Is volatile-lr is enough or allkeys-lru would be a safer settings ?

Is all Drupal cache keys have Redis "expire set" ?

berdir’s picture

By default we add a one-year expiration to all cache entries, yes, so that technically makes them volatile. So using volatile-lru should actually allow you to not accidently remove cache tag, flood and other entries like that.

I think the one year thing can be changed, but there isn't really a good reason to do that IMHO.

berdir’s picture

Status: Needs review » Needs work

The 100k limit is actually not existing yet.

Also, this takes too long on an actual site with many invalidations as we fetch them all. I guess we need to split that up into separate pages or so.

amontero’s picture

Issue summary: View changes

Linking to related module (Redis Info) for completion.

landsman’s picture

This is looking good, is here some new progress please? :)

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new11.68 KB
new11.9 KB

Updated this to also work with predis (although I just learned that it is basically unsupported now), added some checks on the cache tags limit and also included the improvements from O'Briat.

andypost’s picture

@Berdir what you mean with unsupported? Pecl extension looks perfectly supported

berdir’s picture

Predis is the php library, which is unmaintained. php-redis is the extension.

  • Berdir committed 3475e59 on 8.x-1.x
    Issue #2848872 by Berdir, O'Briat: Add status page and some statistics
    
berdir’s picture

Status: Needs review » Fixed

Finally committed, lets see how well this will work :)

Status: Fixed » Closed (fixed)

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