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

Early draft of caching #379

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Early draft of caching #379

wants to merge 4 commits into from

Conversation

Yoric
Copy link
Contributor

@Yoric Yoric commented Sep 30, 2022

This is a first attempt to add a minimal layer of caching on top of MatrixClient.

The objective is to reduce the amount of calls to the homeserver, plus gain performance. Some auditing shows that we place lots of calls that are simply useless because we are calling to request data that we already have. However, we don't want to cache everything as that would cost considerable amounts of memory in the Many-Mjölnir scenario. So we rather let code register for caching stuff that it is interested in.

In practice:

  • we now cache the user id, localpart, domain in a single place (previously, it was cached in many places, uncached in many more);
  • code can request a cache for specific account data types (previously, very little of it was cached);
  • in the future, I'd like to expand this with the ability to request a cache for specific state events in specific rooms (at the moment, none of it is cached afaict).

Just caching the user id should already visibly reduce the amount of requests that we perform.

@Yoric Yoric requested a review from Gnuxie September 30, 2022 15:36
@Yoric Yoric marked this pull request as draft September 30, 2022 15:36
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.

None yet

1 participant