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

Lower minumum batch size to 1 for background updates #11422

Merged
merged 5 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11422.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance of various background updates related to device inboxes.
babolivier marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion synapse/storage/background_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class BackgroundUpdater:
process and autotuning the batch size.
"""

MINIMUM_BACKGROUND_BATCH_SIZE = 100
MINIMUM_BACKGROUND_BATCH_SIZE = 1
DEFAULT_BACKGROUND_BATCH_SIZE = 100
BACKGROUND_UPDATE_INTERVAL_MS = 1000
BACKGROUND_UPDATE_DURATION_MS = 100
Expand Down
25 changes: 17 additions & 8 deletions tests/rest/admin/test_background_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from synapse.api.errors import Codes
from synapse.rest.client import login
from synapse.server import HomeServer
from synapse.storage.background_updates import BackgroundUpdater

from tests import unittest

Expand Down Expand Up @@ -150,9 +151,11 @@ def test_status_bg_update(self):
"current_updates": {
"master": {
"name": "test_update",
"average_items_per_ms": 0.1,
"average_items_per_ms": 0.001,
"total_duration_ms": 1000.0,
"total_item_count": 100,
"total_item_count": (
BackgroundUpdater.MINIMUM_BACKGROUND_BATCH_SIZE
),
}
},
"enabled": True,
Expand Down Expand Up @@ -203,9 +206,11 @@ def test_enabled(self):
"current_updates": {
"master": {
"name": "test_update",
"average_items_per_ms": 0.1,
"average_items_per_ms": 0.001,
"total_duration_ms": 1000.0,
"total_item_count": 100,
"total_item_count": (
BackgroundUpdater.MINIMUM_BACKGROUND_BATCH_SIZE
),
}
},
"enabled": False,
Expand All @@ -230,9 +235,11 @@ def test_enabled(self):
"current_updates": {
"master": {
"name": "test_update",
"average_items_per_ms": 0.1,
"average_items_per_ms": 0.001,
"total_duration_ms": 1000.0,
"total_item_count": 100,
"total_item_count": (
BackgroundUpdater.MINIMUM_BACKGROUND_BATCH_SIZE
),
}
},
"enabled": False,
Expand Down Expand Up @@ -267,9 +274,11 @@ def test_enabled(self):
"current_updates": {
"master": {
"name": "test_update",
"average_items_per_ms": 0.1,
"average_items_per_ms": 0.001,
"total_duration_ms": 2000.0,
"total_item_count": 200,
"total_item_count": (
2 * BackgroundUpdater.MINIMUM_BACKGROUND_BATCH_SIZE
),
}
},
"enabled": True,
Expand Down