File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
synapse/storage/databases/main Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -461,6 +461,21 @@ async def get_subscription_for_thread(
461461
462462 return ThreadSubscription (automatic = automatic )
463463
464+ # max_entries=100 rationale:
465+ # this returns a potentially large datastructure
466+ # (since each entry contains a set which contains a potentially large number of user IDs),
467+ # whereas the default of 10'000 entries for @cached feels more
468+ # suitable for very small cache entries.
469+ #
470+ # Overall, when bearing in mind the usual profile of a small community-server or company-server
471+ # (where cache tuning hasn't been done, so we're in out-of-box configuration), it is very
472+ # unlikely we would benefit from keeping hot the subscribers for as many as 100 threads,
473+ # since it's unlikely that so many threads will be active in a short span of time on a small homeserver.
474+ # It feels that medium servers will probably also not exhaust this limit.
475+ # Larger homeservers are more likely to be carefully tuned, either with a larger global cache factor
476+ # or carefully following the usage patterns & cache metrics.
477+ # Finally, the query is not so intensive that computing it every time is a huge deal, but given people
478+ # often send messages back-to-back in the same thread it seems like it would offer a mild benefit.
464479 @cached (max_entries = 100 )
465480 async def get_subscribers_to_thread (
466481 self , room_id : str , thread_root_event_id : str
You can’t perform that action at this time.
0 commit comments