Skip to content

Improve Admin Token Caching #50

@gierens

Description

@gierens

At the moment the Token is cached inside an RwLock inside the TokenHandler and used at least once on every route for user token validation and thus might degrade API performance. There are multiple options to improve this:

  1. Use a long-lived admin token, like 100 years, infinite life-time is not allowed unfortunately.
  2. Use an external cache like Redis.
  3. Use more advanced in-memory caching, like initializing a global token variable via OnceCell and then use a cached function to retrieve (and update) this variable.

I'm not the biggest fan of introducing another external dependency like Redis here, but sooner or later it might come in anyway. The long-lived token is the sledgehammer solution, simple and effective, and could at least be a temporary fix. The advanced in-memory caching is interesting since it doesn't change the way we use tokens without introducing any external cache.

Before really implementing this one should probably also consider how much the RwLock actually matters in terms of performance in comparison to the Openstack API call it is used for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apifeatrustPull requests that update Rust codesrc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions