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 syncing of big accounts: add caching, increase timeout #321

Closed
wants to merge 2 commits into from

Conversation

MayeulC
Copy link

@MayeulC MayeulC commented Aug 10, 2022

Problem

Solution

  • Increase the default nginx timeout for the sync endpoint, from 60s. 7 minutes is arbitrary, but should provide a lot more time for syncing before it is attempted again, while still being a reasonable waiting time for big accounts.
  • Introduce caching of sync response. If connection is cut while syncing, the server doesn't have to re-compute everything. This will use slightly more memory (but not that much, it seems). It can also be disabled in the config.

I also left commented out other caching options I use as I have plenty of RAM. The comments are taken from upstream homeserver.yaml. This should make it easier for curious user to play with cache settings, and can be activated by default at a later time.

PR Status

  • Code finished and ready to be reviewed/tested
  • The fix/enhancement were manually tested (if applicable)

Automatic tests

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

@lapineige
Copy link
Member

This should make it easier for curious user to play with cache settings, and can be activated by default at a later time.

Maybe we should shortly document that in this repository ReadMe (for instance), to improve discoverability of such features ?

@MayeulC
Copy link
Author

MayeulC commented Aug 10, 2022

Actually my comments are a bit outdated, it seems (I've been running the current config for about one year) : upstream changed the default caching period to 2 min a few months ago: matrix-org/synapse#13042 so maybe the change isn't that necessary after all.

Element timeouts after 90s though, which is longer than nginx's default of (IIRC) 60s.

Hmm, about the documentation, yes, but I would rather point to upstream docs, and/or the config file comments.

Copy link

@Josue-T Josue-T left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested but look like nice

@lapineige
Copy link
Member

Hmm, about the documentation, yes, but I would rather point to upstream docs, and/or the config file comments.

I don't mean a full tutorial : mentioning the existence of these settings, pointing to the doc and/or the specific file to modify, is enough :)

@lapineige
Copy link
Member

By the way, should this be pointing to Testing instead ?

@MayeulC
Copy link
Author

MayeulC commented Aug 11, 2022

Sorry, I clicked too fast in the GitHub interface. Edit: changed base

Also, I had forgotten part of the nginx config... And I was wondering why Matrix was so silent today :P

@MayeulC MayeulC changed the base branch from master to testing August 15, 2022 19:19
@MayeulC
Copy link
Author

MayeulC commented Aug 15, 2022

I added a commit that mentions cache tuning. I am not sure the preferred way to edit the configuration is by editing homeserver.yaml, but that's what I've been doing (overwritten on upgrade, hence the PR).

@@ -35,6 +35,10 @@ After that you can install it without problem.
The package uses a prebuilt python virtual environnement. The binary are taken from this repository: https://github.com/Josue-T/synapse_python_build
The script to build the binary is also available.

### Performance Tuning

Depending on the amount of RAM on your système, you might want to tune the cache configuration in `/etc/matrix-synapse/homeserver.yaml`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be good to put this in a specific file like /etc/matrix-synapse/conf.d/cache.yaml to avoid that this settings is always override by the update.

And the best solution is to give the possibility to edit this from the config pannel.

@Josue-T
Copy link

Josue-T commented Mar 8, 2024

Closing as there are still some work to make it working.

@Josue-T Josue-T closed this Mar 8, 2024
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

3 participants