/health endpoint triggers cache tag invalidation

Created on 6 April 2023, over 1 year ago
Updated 23 August 2023, over 1 year ago

Whenever a call is made to the /health endpoint, I'm seeing some cache tag invalidation triggered in the database. On a clustered drupal setup, with multiple frontend load balancers, this is generating a lot of unnecessary database traffic. Is there any way to prevent this?

Here is part of the SQL log:

                2124806 Query   SELECT "cid", "data", "created", "expire", "serialized", "tags", "checksum" FROM "cache_container" WHERE "cid" IN ( 'service_container:prod:9.5.5::Linux:N;' ) ORDER BY "cid"
                2124806 Query   SELECT "tag", "invalidations" FROM "cachetags" WHERE "tag" IN ( 'memcache:config' )
                2124806 Query   SELECT "tag", "invalidations" FROM "cachetags" WHERE "tag" IN ( 'memcache:discovery' )
                2124806 Query   SELECT "tag", "invalidations" FROM "cachetags" WHERE "tag" IN ( 'memcache:bootstrap' )
                2124806 Query   SELECT "name", "value" FROM "key_value" WHERE "name" IN ( 'system.maintenance_mode' ) AND "collection" = 'state'
                2124806 Query   SELECT "base_table"."id" AS "id", "base_table"."path" AS "path", "base_table"."alias" AS "alias", "base_table"."langcode" AS "langcode"
FROM
"path_alias" "base_table"
WHERE ("base_table"."status" = '1') AND ("base_table"."alias" LIKE '/health' ESCAPE '\\') AND ("base_table"."langcode" IN ('en', 'und'))
ORDER BY "base_table"."langcode" ASC, "base_table"."id" DESC
                2124806 Query   SELECT "tag", "invalidations" FROM "cachetags" WHERE "tag" IN ( 'memcache:data', 'route_match' )
                2124806 Query   SELECT "tag", "invalidations" FROM "cachetags" WHERE "tag" IN ( 'routes' )
                2124806 Quit
🐛 Bug report
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

🇨🇦Canada fozboz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States pwolanin

    It's looking for invalid cache tags in that SQL, it's not updating or deleting any.

    A problem might be that it's checking for a path alias - consider turning off path aliases if you don't need them?

    Drupal core doesn't seem to have a facility for indicating some path will not be aliased, or an alias should be ignored. You could subclass \Drupal\path_alias\AliasManager and replace the alias manager service to achieve that and/or propose a core patch to add the capability.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇫🇮Finland back-2-95 Helsinki

    Cannot see this being related to this module so closing the issue.

  • 🇫🇮Finland back-2-95 Helsinki

    If some more evidence comes up, please let us know.

Production build 0.71.5 2024