Skip to content

Add an access token introspection cache to make Matrix Authentication Service integration (MSC3861) more efficient. #18231

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

Merged
merged 4 commits into from
Apr 1, 2025

Conversation

reivilibre
Copy link
Contributor

@reivilibre reivilibre commented Mar 12, 2025

Evolution of cd78f3d

This cache does not have any explicit invalidation, but this is deemed acceptable (see code comment).

We may still prefer to add it eventually, letting us bump up the Time-To-Live (TTL) on the cache as we currently set a 2 minute expiry
to balance the fact that we have no explicit invalidation.

This cache makes several things more efficient:

  • reduces number of outbound requests from Synapse, reducing CPU utilisation + network I/O
  • reduces request handling time in Synapse, which improves client-visible latency
  • reduces load on MAS and its database

Other than that, this PR also introduces support for expires_in (seconds) on the introspection response.
This lets the cached responses expire at the proper expiry time of the access token, whilst avoiding clock skew issues.

Corresponds to: element-hq/matrix-authentication-service#4241

@reivilibre reivilibre force-pushed the rei/init_token_intro_cache branch from be5f494 to 0c02022 Compare March 12, 2025 14:33
@reivilibre reivilibre marked this pull request as ready for review March 12, 2025 14:33
@reivilibre reivilibre requested a review from a team as a code owner March 12, 2025 14:33
reivilibre added a commit to element-hq/matrix-authentication-service that referenced this pull request Mar 17, 2025
reivilibre added a commit to element-hq/matrix-authentication-service that referenced this pull request Mar 17, 2025
@reivilibre reivilibre merged commit 1709234 into develop Apr 1, 2025
39 checks passed
@reivilibre reivilibre deleted the rei/init_token_intro_cache branch April 1, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants