Make Synapse cache factor configurable

This commit is contained in:
Slavi Pantaleev 2018-09-27 10:03:31 +03:00
parent 161854e6d7
commit 242f388af3
5 changed files with 27 additions and 1 deletions

View file

@ -1,3 +1,13 @@
# 2018-09-27
## Synapse Cache Factor made configurable
The playbook now makes the Synapse cache factor configurable, through the playbook's `matrix_synapse_cache_factor` variable (having a default value of `0.5`).
Changing that value allows you to potentially decrease RAM usage or to increase performance by caching more stuff.
Some information on it is available here: https://github.com/matrix-org/synapse#help-synapse-eats-all-my-ram
# 2018-09-26 # 2018-09-26
## Disabling Docker container logging ## Disabling Docker container logging

View file

@ -74,6 +74,13 @@ matrix_synapse_password_config_pepper: ""
# Controls the number of events that Matrix Synapse caches in memory. # Controls the number of events that Matrix Synapse caches in memory.
matrix_synapse_event_cache_size: "100K" matrix_synapse_event_cache_size: "100K"
# Controls cache sizes for Matrix Synapse via the SYNAPSE_CACHE_FACTOR environment variable.
# Raise this to increase cache sizes or lower it to potentially lower memory use.
# To learn more, see:
# - https://github.com/matrix-org/synapse#help-synapse-eats-all-my-ram
# - https://github.com/matrix-org/synapse/issues/3939
matrix_synapse_cache_factor: 0.5
# A list of additional "volumes" to mount in the container. # A list of additional "volumes" to mount in the container.
# This list gets populated dynamically based on Synapse extensions that have been enabled. # This list gets populated dynamically based on Synapse extensions that have been enabled.
# Contains definition objects like this: `{"src": "/outside", "dst": "/inside", "options": "rw|ro|slave|.."} # Contains definition objects like this: `{"src": "/outside", "dst": "/inside", "options": "rw|ro|slave|.."}

View file

@ -61,6 +61,13 @@
dest: "{{ matrix_synapse_config_dir_path }}/{{ hostname_matrix }}.log.config" dest: "{{ matrix_synapse_config_dir_path }}/{{ hostname_matrix }}.log.config"
mode: 0644 mode: 0644
- name: Ensure Synapse environment variables file created
template:
src: "{{ role_path }}/templates/env/env-synapse.j2"
dest: "{{ matrix_environment_variables_data_path }}/synapse"
owner: root
mode: 0600
- name: Ensure matrix-synapse.service installed - name: Ensure matrix-synapse.service installed
template: template:
src: "{{ role_path }}/templates/systemd/matrix-synapse.service.j2" src: "{{ role_path }}/templates/systemd/matrix-synapse.service.j2"

View file

@ -0,0 +1,2 @@
SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
SYNAPSE_CACHE_FACTOR={{ matrix_synapse_cache_factor }}

View file

@ -27,6 +27,7 @@ ExecStartPre=/bin/sleep 5
{% endif %} {% endif %}
ExecStart=/usr/bin/docker run --rm --name matrix-synapse \ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \
--log-driver=none \ --log-driver=none \
--env-file={{ matrix_environment_variables_data_path }}/synapse \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
-p 8448:8448 \ -p 8448:8448 \
{% if not matrix_nginx_proxy_enabled %} {% if not matrix_nginx_proxy_enabled %}
@ -38,7 +39,6 @@ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \
{% for volume in matrix_synapse_container_additional_volumes %} {% for volume in matrix_synapse_container_additional_volumes %}
-v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
{% endfor %} {% endfor %}
-e SYNAPSE_CONFIG_PATH=/data/homeserver.yaml \
{{ matrix_docker_image_synapse }} {{ matrix_docker_image_synapse }}
ExecStop=-/usr/bin/docker kill matrix-synapse ExecStop=-/usr/bin/docker kill matrix-synapse
ExecStop=-/usr/bin/docker rm matrix-synapse ExecStop=-/usr/bin/docker rm matrix-synapse