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

Make SIGHUP reload and update cache factor values #12373

Closed
erikjohnston opened this issue Apr 5, 2022 · 5 comments · Fixed by #12673
Closed

Make SIGHUP reload and update cache factor values #12373

erikjohnston opened this issue Apr 5, 2022 · 5 comments · Fixed by #12673
Assignees
Labels
T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.

Comments

@erikjohnston
Copy link
Member

This would be very useful when you want to update cache factors across many workers without having to restart them all (e.g. when they're under load and restarting would cause issues)

@erikjohnston erikjohnston added the T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. label Apr 5, 2022
@DMRobertson DMRobertson self-assigned this May 8, 2022
@DMRobertson
Copy link
Contributor

Is this as simple as having a SIGHUP handler call this function?

def resize_all_caches(self) -> None:
"""Ensure all cache sizes are up to date
For each cache, run the mapped callback function with either
a specific cache factor or the default, global one.
"""
# block other threads from modifying _CACHES while we iterate it.
with _CACHES_LOCK:
for cache_name, callback in _CACHES.items():
new_factor = self.cache_factors.get(cache_name, self.global_factor)
callback(new_factor)

@DMRobertson
Copy link
Contributor

Oh no, we'd need to get the homeserver to reparse the config first.

@clokep
Copy link
Member

clokep commented May 9, 2022

We do something similar for logging config near

appbase.register_sighup(_reload_logging_config, log_config_path)

@DMRobertson
Copy link
Contributor

That's a helpful pointer, thanks. WIll still have to work out how to wrangle our config class magic.

@clokep
Copy link
Member

clokep commented May 9, 2022

Yeah, although I realize now it isn't quite the same since the logging stuff has a separate config file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants