dendrite: /sync performance slow since v0.10.0
Background information
- v0.10.1
- Monolith
- Postgres
- Running in Docker
Description
I’m running Dendrite in Docker and noticed a huge difference in performance when doing initial sync when switching from v0.9.9 to v0.10.0 or v0.10.1
Response times in my server: With docker image matrixdotorg/dendrite-monolith:v0.9.9
# With existing filter
$ curl -o /dev/null -s -w 'Total: %{time_total}s\n' 'https://[my-domain]/_matrix/client/r0/sync?filter=7&timeout=0&_cacheBuster=1665145519640&access_token=[redacted]'
Total: 1,113253s
# With inline filter
$ curl -o /dev/null -s -w 'Total: %{time_total}s\n' 'https://[my-domain]/_matrix/client/r0/sync?filter=%7B%22room%22%3A%7B%22timeline%22%3A%7B%22limit%22%3A100%7D%7D%7D&timeout=0&access_token=[redacted]'
Total: 6,983575s
With docker image matrixdotorg/dendrite-monolith:v0.10.1
# With existing filter
$ curl -o /dev/null -s -w 'Total: %{time_total}s\n' 'https://[my-domain]/_matrix/client/r0/sync?filter=7&timeout=0&_cacheBuster=1665145519640&access_token=[redacted]'
Total: 5,740234s
# With inline filter
$ curl -o /dev/null -s -w 'Total: %{time_total}s\n' 'https://[my-domain]/_matrix/client/r0/sync?filter=%7B%22room%22%3A%7B%22timeline%22%3A%7B%22limit%22%3A100%7D%7D%7D&timeout=0&access_token=[redacted]'
Total: 15,450809s
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (6 by maintainers)
Commits related to this issue
- Optimize history visibility checks (#2848) This optimizes history visibility checks by (mostly) avoiding database hits. Possibly solves https://github.com/matrix-org/dendrite/issues/2777 Co-auth... — committed to matrix-org/dendrite by S7evinK 2 years ago
- Optimize `/sync` and history visibility (#2961) Should fix the following issues or make a lot less worse when using Postgres: The main issue behind #2911: The client gives up after a certain time... — committed to matrix-org/dendrite by S7evinK a year ago
I did an experiment and set
max_open_conns: 90
as in default config and ran the same requests, but I did not notice any difference in response times.Server I am running, does not get a lot of traffic, and I’m almost alone running queries, so available connections do not seem to be exhausted. Looking from the metrics that PostgreSQL reports, I can tell that Dendrite uses 5 connections or less.