Add TTL cache with single-flight dedup to Keycloak filter_authorized_dag_ids - #63184
Merged
Merged
Conversation
vincbeck
reviewed
Mar 9, 2026
stegololz
force-pushed
the
feature/keycloak-cache-filter
branch
from
March 9, 2026 14:43
f2d60e7 to
9d0800f
Compare
vincbeck
reviewed
Mar 9, 2026
vincbeck
approved these changes
Mar 9, 2026
stegololz
marked this pull request as ready for review
March 9, 2026 17:21
…dag_ids Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ter for backward compatibility
…ingle-flight logic
…ts for single flight logic
stegololz
force-pushed
the
feature/keycloak-cache-filter
branch
from
March 10, 2026 08:25
3f5c917 to
37d3bc5
Compare
dominikhei
pushed a commit
to dominikhei/airflow
that referenced
this pull request
Mar 11, 2026
Pyasma
pushed a commit
to Pyasma/airflow
that referenced
this pull request
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance improvement for the Keycloak auth manager. Loading the
home/DAG UI pages triggers multiple
filter_authorized_dag_idscallsfor the same user and DAG set. Without caching, every call hits
Keycloak individually, making the UI slow.
This adds a TTL cache on
filter_authorized_dag_idsso only the firstcall hits Keycloak and subsequent identical calls return from cache.
A single-flight deduplication layer prevents the thundering herd problem
where N concurrent cache misses all fire N identical Keycloak requests
before any can populate the cache.
The cache TTL is currently hardcoded at 30s. I'm open to discussion on
the right value or whether it should be configurable.
This is a pragmatic solution to reduce per-resource check overhead.
Keycloak's UMA permission endpoint currently requires individual
queries per resource (keycloak/keycloak#45311). If a better approach
emerges — upstream or otherwise — this can be revisited.
related: keycloak/keycloak#45311
Was generative AI tooling used to co-author this PR?