Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Admin Token Caching #50

Open
gierens opened this issue Sep 16, 2024 · 3 comments
Open

Improve Admin Token Caching #50

gierens opened this issue Sep 16, 2024 · 3 comments
Labels
api feat rust Pull requests that update Rust code src

Comments

@gierens
Copy link
Member

gierens commented Sep 16, 2024

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, but at not 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.

@gierens gierens added rust Pull requests that update Rust code api src feat labels Sep 16, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

Copy link

This issue is stale because it has been open for 30 days with no activity.

Copy link

github-actions bot commented Jan 4, 2025

This issue is stale because it has been open for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api feat rust Pull requests that update Rust code src
Projects
None yet
Development

No branches or pull requests

1 participant