summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-01-29 14:30:15 +0000
committerRichard van der Hoff <richard@matrix.org>2018-01-29 14:30:15 +0000
commit02ba118f81009b1c3ae290a17c35e1b9d75e802b (patch)
treefecee326f27ccd6f97392b0d83b3ef4dc48f120d /synapse/http
parentUse a connection pool for the SimpleHttpClient (diff)
downloadsynapse-02ba118f81009b1c3ae290a17c35e1b9d75e802b.tar.xz
Increase http conn pool size
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/client.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 930d713013..f3e4973c2e 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -18,6 +18,7 @@ from OpenSSL.SSL import VERIFY_NONE
 from synapse.api.errors import (
     CodeMessageException, MatrixCodeMessageException, SynapseError, Codes,
 )
+from synapse.util.caches import CACHE_SIZE_FACTOR
 from synapse.util.logcontext import make_deferred_yieldable
 from synapse.util import logcontext
 import synapse.metrics
@@ -67,7 +68,11 @@ class SimpleHttpClient(object):
         self.hs = hs
 
         pool = HTTPConnectionPool(reactor)
-        pool.maxPersistentPerHost = 5
+
+        # the pusher makes lots of concurrent SSL connections to sygnal, and
+        # tends to do so in batches, so we need to allow the pool to keep lots
+        # of idle connections around.
+        pool.maxPersistentPerHost = max((100 * CACHE_SIZE_FACTOR, 5))
         pool.cachedConnectionTimeout = 2 * 60
 
         # The default context factory in Twisted 14.0.0 (which we require) is