Skip to content

core: Per-request caching for serialized users#18446

Open
joaocfernandes wants to merge 1 commit intogoauthentik:version-2025.10from
joaocfernandes:jf/groups-serialization-cache
Open

core: Per-request caching for serialized users#18446
joaocfernandes wants to merge 1 commit intogoauthentik:version-2025.10from
joaocfernandes:jf/groups-serialization-cache

Conversation

@joaocfernandes
Copy link
Contributor

Details

Improve execution time for calls to groups/.

For situations where a huge number of groups exists and a huge number of users scattered around them, we can save time avoiding re-serialization, if the serialization result for each user is cached by request.

This has the tradeoff of creating a cache per request. The invalidation model is simple as it only lives for the period of the request and therefore it's expected a low-memory footprint , if page_size is within a reasonable value.


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make docs)

@netlify
Copy link

netlify bot commented Nov 29, 2025

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit f945662
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/692ad06c026d0b0008efe5bc

@netlify
Copy link

netlify bot commented Nov 29, 2025

Deploy Preview for authentik-integrations canceled.

Name Link
🔨 Latest commit f945662
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/692ad06e38aa2f0008509813

@netlify
Copy link

netlify bot commented Nov 29, 2025

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit f945662
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/692ad06eee88930008531c01

- Add cache initialization in GroupViewSet.initialize_request()
@joaocfernandes joaocfernandes force-pushed the jf/groups-serialization-cache branch from 33a5eb9 to f945662 Compare November 29, 2025 10:52
@joaocfernandes joaocfernandes changed the base branch from main to version-2025.10 November 29, 2025 10:53
@joaocfernandes joaocfernandes marked this pull request as ready for review November 29, 2025 11:22
@joaocfernandes joaocfernandes requested a review from a team as a code owner November 29, 2025 11:22
@rissson rissson self-assigned this Dec 17, 2025
@rissson rissson moved this from Todo to Needs review in authentik Core Dec 17, 2025
@rissson rissson moved this from Needs review to In Progress in authentik Core Dec 17, 2025
@rissson rissson added this to the Release 2026.2 milestone Dec 17, 2025
@BeryJu BeryJu changed the title Per-request caching for serialized users core: Per-request caching for serialized users Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants