Skip to content

⚡️(auth) cache token introspection and service resolution #184

Open

Description

@lunika

Problem

Each search/delete request:

  1. calls the OIDC provider's introspection endpoint (ResourceServerAuthentication, no caching), and
  2. queries Postgres for the Service matching the token audience, plus its sub-services (indexing.py#L84-L91).

Each index request also queries Service by token, and runs an indices.get on OpenSearch.

This adds latency to every search (search-as-you-type makes it worse) and puts load on the identity provider. It also makes Find unavailable whenever the provider is slow or down.

Proposal

  • Cache introspection results per token hash for a short TTL, bounded by the token's exp (check whether django-lasuite supports this already).
  • Cache the Service → allowed-indices resolution, invalidated when a Service is saved.
  • Replace LocMemCache with a shared cache (Redis is already deployed) so the cache works across replicas.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions