summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-03-22 13:12:01 +0000
committerErik Johnston <erik@matrix.org>2016-03-22 13:12:01 +0000
commitf93304e77fbe90b5531247c7f6cdb02c42dd60a7 (patch)
tree4fbadfe2555015dbec429b516bb9160c40a5189c /synapse
parentMerge pull request #657 from matrix-org/erikj/roomlist (diff)
parentMake stateGroupCache honour CACHE_SIZE_FACTOR (diff)
downloadsynapse-f93304e77fbe90b5531247c7f6cdb02c42dd60a7.tar.xz
Merge pull request #659 from matrix-org/erikj/state_cache_factor
Make stateGroupCache honour CACHE_SIZE_FACTOR
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/_base.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 7dc67ecd57..583b77a835 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -26,6 +26,10 @@ from twisted.internet import defer
 import sys
 import time
 import threading
+import os
+
+
+CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.1))
 
 
 logger = logging.getLogger(__name__)
@@ -163,7 +167,9 @@ class SQLBaseStore(object):
         self._get_event_cache = Cache("*getEvent*", keylen=3, lru=True,
                                       max_entries=hs.config.event_cache_size)
 
-        self._state_group_cache = DictionaryCache("*stateGroupCache*", 2000)
+        self._state_group_cache = DictionaryCache(
+            "*stateGroupCache*", 2000 * CACHE_SIZE_FACTOR
+        )
 
         self._event_fetch_lock = threading.Condition()
         self._event_fetch_list = []