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

Reload cache factors from disk on SIGHUP #12673

Merged
merged 17 commits into from
May 11, 2022
Merged
2 changes: 2 additions & 0 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from twisted.protocols.tls import TLSMemoryBIOFactory
from twisted.python.threadpool import ThreadPool

import synapse.util.caches
from synapse.api.constants import MAX_PDU_SIZE
from synapse.app import check_bind_error
from synapse.app.phone_stats_home import start_phone_stats_home
Expand Down Expand Up @@ -499,6 +500,7 @@ def reload_cache_config(config: HomeServerConfig) -> None:
previous_cache_config.__dict__,
config.caches.__dict__,
)
synapse.util.caches.TRACK_MEMORY_USAGE = config.caches.track_memory_usage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so this is safe to update to False, but I'm not 100% sure its safe to update this to True. At the very least the metrics will be wrong for a while, as we won't track memory usage for anything that is already in the cache.

Happy for us to do one of:

  1. Not update this
  2. Only update this to False
  3. Check its safe to update this to True and add a big comment about the fact it will underestimate the cache size for a while

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go for option 1 and update the docstring.

I'll also update the docs to only say that SIGHUP reloads cache factors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more look over please?

config.caches.resize_all_caches()


Expand Down