Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8fcd2ca

Browse files
authored
Merge pull request #4276 from Ralith/performance-advice
Improve advice regarding poor performance
2 parents f2d2ae0 + b36de88 commit 8fcd2ca

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

AUTHORS.rst

+3
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ Jason Robinson <jasonr at matrix.org>
7272

7373
Joseph Weston <joseph at weston.cloud>
7474
+ Add admin API for querying HS version
75+
76+
Benjamin Saunders <ben.e.saunders at gmail dot com>
77+
* Documentation improvements

README.rst

+25-7
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,11 @@ log lines and looking for any 'Processed request' lines which take more than
340340
a few seconds to execute. Please let us know at #synapse:matrix.org if
341341
you see this failure mode so we can help debug it, however.
342342

343-
Help!! Synapse eats all my RAM!
344-
-------------------------------
343+
Help!! Synapse is slow and eats all my RAM/CPU!
344+
-----------------------------------------------
345+
346+
First, ensure you are running the latest version of Synapse, using Python 3
347+
with a PostgreSQL database.
345348

346349
Synapse's architecture is quite RAM hungry currently - we deliberately
347350
cache a lot of recent room data and metadata in RAM in order to speed up
@@ -352,14 +355,29 @@ variable. The default is 0.5, which can be decreased to reduce RAM usage
352355
in memory constrained enviroments, or increased if performance starts to
353356
degrade.
354357

358+
However, degraded performance due to a low cache factor, common on
359+
machines with slow disks, often leads to explosions in memory use due
360+
backlogged requests. In this case, reducing the cache factor will make
361+
things worse. Instead, try increasing it drastically. 2.0 is a good
362+
starting value.
363+
355364
Using `libjemalloc <http://jemalloc.net/>`_ can also yield a significant
356-
improvement in overall amount, and especially in terms of giving back RAM
357-
to the OS. To use it, the library must simply be put in the LD_PRELOAD
358-
environment variable when launching Synapse. On Debian, this can be done
359-
by installing the ``libjemalloc1`` package and adding this line to
360-
``/etc/default/matrix-synapse``::
365+
improvement in overall memory use, and especially in terms of giving back
366+
RAM to the OS. To use it, the library must simply be put in the
367+
LD_PRELOAD environment variable when launching Synapse. On Debian, this
368+
can be done by installing the ``libjemalloc1`` package and adding this
369+
line to ``/etc/default/matrix-synapse``::
361370

362371
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1
363372

364373
This can make a significant difference on Python 2.7 - it's unclear how
365374
much of an improvement it provides on Python 3.x.
375+
376+
If you're encountering high CPU use by the Synapse process itself, you
377+
may be affected by a bug with presence tracking that leads to a
378+
massive excess of outgoing federation requests (see `discussion
379+
<https://github.com/matrix-org/synapse/issues/3971>`_). If metrics
380+
indicate that your server is also issuing far more outgoing federation
381+
requests than can be accounted for by your users' activity, this is a
382+
likely cause. The misbehavior can be worked around by setting
383+
``use_presence: false`` in the Synapse config file.

changelog.d/4276.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve README section on performance troubleshooting.

0 commit comments

Comments
 (0)