matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Don't wake up destination transaction queue if they're not due for retry. #16223

Closed erikjohnston closed 1 year ago

erikjohnston commented 1 year ago

Based on #16221.

When we send an EDU to a large number of hosts (e.g. presence or a receipt in a large room), we instansiate a PerDestinationQueue per host. This has a bunch of overhead, and is pointless for hosts that are marked as "down".

To avoid this, we make sure to only wake up destinations that we will actually try to contact with the new data. This dramatically reduces CPU and memory usages of federation sending in large rooms.

erikjohnston commented 1 year ago

Would love to see some graphs showing perf gains if you have them!

I have a memory graph, but given I deployed it at the start of the weekend I don't think its particularly useful.

Screenshot from 2023-09-04 16-08-50