diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-07-23 23:48:19 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-07-23 23:48:19 +0100 |
commit | 1938cffaea465375d5dd410baa94a6b9b6ded0cc (patch) | |
tree | e9a8928a2703cde367696461f485731009d6f671 /synapse | |
parent | Merge pull request #3584 from matrix-org/erikj/use_cached (diff) | |
download | synapse-1938cffaea465375d5dd410baa94a6b9b6ded0cc.tar.xz |
Add some measure blocks to persist_events
... to help us figure out where 40% of CPU is going
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/storage/events.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index c2910094d0..d13d099d1e 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -417,19 +417,23 @@ class EventsStore(EventsWorkerStore): logger.info( "Calculating state delta for room %s", room_id, ) - current_state = yield self._get_new_state_after_events( - room_id, - ev_ctx_rm, - latest_event_ids, - new_latest_event_ids, - ) + + with Measure("persist_events.get_new_state_after_events"): + current_state = yield self._get_new_state_after_events( + room_id, + ev_ctx_rm, + latest_event_ids, + new_latest_event_ids, + ) + if current_state is not None: current_state_for_room[room_id] = current_state - delta = yield self._calculate_state_delta( - room_id, current_state, - ) - if delta is not None: - state_delta_for_room[room_id] = delta + with Measure("persist_events.calculate_state_delta"): + delta = yield self._calculate_state_delta( + room_id, current_state, + ) + if delta is not None: + state_delta_for_room[room_id] = delta yield self.runInteraction( "persist_events", |