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

json-serializing a sync response can block the reactor for tens of seconds #6998

@richvdh

Description

@richvdh

A response to an initial /sync can easily run to hundreds of megabytes of JSON, which takes tens of seconds of CPU time to serialise from the objects. This monopolises the Twisted reactor thread, causing all sorts of other problems (including dropped replication connections for worker-mode deployments).

To make matters worse, although we have a cache which is supposed to avoid redoing a lot of the hard work for duplicate requests to initialsync (though its effectiveness is disputed, see #3880), we cache the de-serialised version, so have to re-serialise the response for each request. (One reason we have to do this is to populate the age field).

Metadata

Metadata

Assignees

Labels

A-PerformancePerformance, both client-facing and admin-facingZ-Help-WantedWe know exactly how to fix this issue, and would be grateful for any contributionz-p2(Deprecated Label)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions