summary refs log tree commit diff
path: root/synapse/config/server.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-08-15 18:27:42 +0100
committerMatthew Hodgson <matthew@matrix.org>2017-08-15 18:27:42 +0100
commit92168cbbc53ccf941ddcb958452ace8e41a948fd (patch)
tree35f58745d0d4a99adbcf4208aa95ec9129d2d7b2 /synapse/config/server.py
parentMerge pull request #2415 from matrix-org/rav/synctl_cpu_affinity (diff)
downloadsynapse-92168cbbc53ccf941ddcb958452ace8e41a948fd.tar.xz
explain why CPU affinity is a good idea
Diffstat (limited to 'synapse/config/server.py')
-rw-r--r--synapse/config/server.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/config/server.py b/synapse/config/server.py
index 4e4bf6b432..e33cd51f7c 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -153,10 +153,18 @@ class ServerConfig(Config):
         # bit corresponding to the first logical CPU and the highest order bit
         # corresponding to the last logical CPU. Not all CPUs may exist on a
         # given system but a mask may specify more CPUs than are present.
+        #
         # For example:
         #    0x00000001  is processor #0,
         #    0x00000003  is processors #0 and #1,
         #    0xFFFFFFFF  is all processors (#0 through #31).
+        #
+        # This is desirable for Synapse processes (especially workers), which are
+        # inherently single-threaded due to the GIL and can suffer a 30-40% slowdown
+        # due to cache blow-out and thread context switching if the scheduler happens
+        # to schedule the underlying threads across different cores.
+        # See https://www.mirantis.com/blog/improve-performance-python-programs-restricting-single-cpu/
+        #
         # cpu_affinity: 0xFFFFFFFF
 
         # Whether to serve a web client from the HTTP/HTTPS root resource.