| @@ -1,3 +1,23 @@ | |||
| # 2024-02-14 | |||
| ## Much larger Synapse caches and cache auto-tuning enabled by default | |||
| Thanks to [FSG-Cat](https://github.com/FSG-Cat), the playbook now uses much larger caches and enables Synapse's [cache auto-tuning functionality](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caches-and-associated-values). | |||
| This work and the default values used by the playbook are inspired by [Tom Foster](https://github.com/tcpipuk)'s [Synapse homeserver guide](https://tcpipuk.github.io/synapse/deployment/synapse.html). | |||
| The playbook has always used a very conservative cache factor (`matrix_synapse_caches_global_factor`) value of `0.5`, which may be OK for small and underactive deployments, but is not ideal for larger servers. Paradoxically, a small global cache factor value [does not necessarily decrease RAM usage as a whole](https://github.com/matrix-org/synapse/issues/3939). | |||
| The playbook now uses **a 20x larger cache factor** (currently `10`), adjusts a few other cache-related variables, and **enables cache auto-tuning** via the following variables: | |||
| - `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes | |||
| - `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes | |||
| - `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` | |||
| These values should be good defaults for most servers, but may change over time as we experiment further. | |||
| Refer to our new [Tuning caches and cache autotuning](docs/maintenance-synapse.md#tuning-caches-and-cache-autotuning) documentation section for more details. | |||
| # 2024-01-31 | |||
| ## (Backward-compatibility break) Minor changes necessary for some people serving a static website at the base domain | |||
| @@ -207,7 +227,7 @@ As mentioned above, static files like `/.well-known/matrix/*` or your base domai | |||
| All of this has been extracted into a new `matrix-static-files` Ansible role that's part of the playbook. The static files generated by this new role still live at roughly the same place (`/matrix/static-files/public` directory, instead of `/matrix/static-files`). | |||
| The playbook will migrate and update the files automatically. It will also warn you about usage of old variable names, so you can adapt to the new names. | |||
| The playbook will migrate and update the `/.well-known/matrix/*` files automatically but not your own files in `nginx-proxy/data/matrix-domain/` you will need to back these up yourself otherwise they will be lost. It will also warn you about usage of old variable names, so you can adapt to the new names. | |||
| ### A note on performance | |||
| @@ -55,4 +55,4 @@ Choose a strong password for the bot. You can generate a good password with a co | |||
| ## Obtaining an admin access token | |||
| This can be done via `mbc login` then `mbc auth` (see the [maubot documentation](https://docs.mau.fi/maubot/usage/cli/auth.html)). To run these commands you'll need to open the bot docker container with `docker exec -it matrix-bot-maubot sh` | |||
| Alternatively, use Element or curl to [obtain an access token](obtaining-access-tokens.md). However these two methods won't allow the bot to work in encrypted rooms. | |||
| Alternatively, use Element or curl to [obtain an access token](obtaining-access-tokens.md). | |||
| @@ -17,7 +17,7 @@ matrix_synapse_admin_enabled: true | |||
| **Note**: Synapse Admin requires Synapse's [Admin APIs](https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/index.html) to function. Access to them is restricted with a valid access token, so exposing them publicly should not be a real security concern. Still, for additional security, we normally leave them unexposed, following [official Synapse reverse-proxying recommendations](https://github.com/element-hq/synapse/blob/master/docs/reverse_proxy.md#synapse-administration-endpoints). Because Synapse Admin needs these APIs to function, when installing Synapse Admin, the playbook **automatically** exposes the Synapse Admin API publicly for you. Depending on the homeserver implementation you're using (Synapse, Dendrite), this is equivalent to: | |||
| - for Synapse (our default homeserver implementation): `matrix_synapse_container_labels_public_client_synapse_admin_api_enabled: true` | |||
| - for [Synapse](./configuring-playbook-synapse.md) (our default homeserver implementation): `matrix_synapse_container_labels_public_client_synapse_admin_api_enabled: true` | |||
| - for [Dendrite](./configuring-playbook-dendrite.md): `matrix_dendrite_container_labels_public_client_synapse_admin_api_enabled: true` | |||
| @@ -108,6 +108,8 @@ These services are not part of our default installation, but can be enabled by [ | |||
| - [matrixdotorg/mjolnir](https://hub.docker.com/r/matrixdotorg/mjolnir) - the [mjolnir](https://github.com/matrix-org/mjolnir) moderation bot (optional) | |||
| - [gnuxie/draupnir](https://hub.docker.com/r/gnuxie/draupnir) - the [Draupnir](https://github.com/the-draupnir-project/Draupnir/) moderation bot (optional) | |||
| - [awesometechnologies/synapse-admin](https://hub.docker.com/r/awesometechnologies/synapse-admin) - the [synapse-admin](https://github.com/Awesome-Technologies/synapse-admin) web UI tool for administrating users and rooms on your Matrix server (optional) | |||
| - [prom/prometheus](https://hub.docker.com/r/prom/prometheus/) - [Prometheus](https://github.com/prometheus/prometheus/) is a systems and service monitoring system | |||
| @@ -74,8 +74,32 @@ Synapse's presence feature which tracks which users are online and which are off | |||
| If you have enough compute resources (CPU & RAM), you can make Synapse better use of them by [enabling load-balancing with workers](configuring-playbook-synapse.md#load-balancing-with-workers). | |||
| Tuning Synapse's cache factor can help reduce RAM usage. [See the upstream documentation](https://github.com/element-hq/synapse#help-synapse-is-slow-and-eats-all-my-ram-cpu) for more information on what value to set the cache factor to. Use the variable `matrix_synapse_caches_global_factor` to set the cache factor. | |||
| [Tuning your PostgreSQL database](maintenance-postgres.md#tuning-postgresql) could also improve Synapse performance. The playbook tunes the integrated Postgres database automatically, but based on your needs you may wish to adjust tuning variables manually. If you're using an [external Postgres database](configuring-playbook-external-postgres.md), you will aslo need to tune Postgres manually. | |||
| ### Tuning caches and cache autotuning | |||
| Tuning Synapse's cache factor is useful for performance increases but also as part of controlling Synapse's memory use. Use the variable `matrix_synapse_caches_global_factor` to set the cache factor as part of this process. | |||
| **The playbook defaults the global cache factor to a large value** (e.g. `10`). A smaller value (e.g. `0.5`) will decrease the amount used for caches, but will [not necessarily decrease RAM usage as a whole](https://github.com/matrix-org/synapse/issues/3939). | |||
| Tuning the cache factor is useful only to a limited degree (as its crude to do in isolation) and therefore users who are tuning their cache factor should likely look into tuning autotune variables as well (see below). | |||
| Cache autotuning is **enabled by default** and controlled via the following variables: | |||
| - `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes | |||
| - `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes | |||
| - `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` | |||
| You can **learn more about cache-autotuning and the global cache factor settings** in the [Synapse's documentation on caches and associated values](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caches-and-associated-values). | |||
| To **disable cache auto-tuning**, unset all values: | |||
| ```yml | |||
| matrix_synapse_cache_autotuning_max_cache_memory_usage: '' | |||
| matrix_synapse_cache_autotuning_target_cache_memory_usage: '' | |||
| matrix_synapse_cache_autotuning_min_cache_ttl: '' | |||
| ``` | |||
| Users who wish to lower Synapse's RAM footprint should look into lowering the global cache factor and tweaking the autotune variables (or disabling auto-tuning). If your cache factor is too low for a given auto tune setting your caches will not reach autotune thresholds and autotune won't be able to do its job. Therefore, when auto-tuning is enabled (which it is by default), it's recommended to have your cache factor be large. | |||
| See also [How do I optimize this setup for a low-power server?](faq.md#how-do-i-optimize-this-setup-for-a-low-power-server). | |||
| @@ -2,11 +2,11 @@ | |||
| To install Matrix services using this Ansible playbook, you need: | |||
| - (Recommended) An **x86** server ([What kind of server specs do I need?](faq.md#what-kind-of-server-specs-do-i-need)) running one of these operating systems: | |||
| - **CentOS** (7 only for now; [8 is not yet supported](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300)) | |||
| - **Debian** (10/Buster or newer) | |||
| - **Ubuntu** (18.04 or newer, although [20.04 may be problematic](ansible.md#supported-ansible-versions)) | |||
| - (Recommended) An **x86** server ([What kind of server specs do I need?](faq.md#what-kind-of-server-specs-do-i-need)) running one of these operating systems that make use of [systemd](https://systemd.io/): | |||
| - **Archlinux** | |||
| - **CentOS**, **Rocky Linux**, **AlmaLinux**, or possibly other RHEL alternatives (although your mileage may vary) | |||
| - **Debian** (10/Buster or newer) | |||
| - **Ubuntu** (18.04 or newer, although [20.04 may be problematic](ansible.md#supported-ansible-versions) if you run the Ansible playbook on it) | |||
| Generally, newer is better. We only strive to support released stable versions of distributions, not betas or pre-releases. This playbook can take over your whole server or co-exist with other services that you have there. | |||
| @@ -25,7 +25,7 @@ | |||
| version: v10.3.1-2 | |||
| name: grafana | |||
| - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-jitsi.git | |||
| version: v9220-0 | |||
| version: v9258-0 | |||
| name: jitsi | |||
| - src: git+https://gitlab.com/etke.cc/roles/ntfy.git | |||
| version: v2.8.0-1 | |||
| @@ -67,7 +67,7 @@ | |||
| version: v1.0.0-0 | |||
| name: timesync | |||
| - src: git+https://github.com/devture/com.devture.ansible.role.traefik.git | |||
| version: v2.10.7-0 | |||
| version: v2.11.0-0 | |||
| name: traefik | |||
| - src: git+https://github.com/devture/com.devture.ansible.role.traefik_certs_dumper.git | |||
| version: v2.8.3-1 | |||
| @@ -10,7 +10,7 @@ matrix_bot_postmoogle_docker_repo_version: "{{ 'main' if matrix_bot_postmoogle_v | |||
| matrix_bot_postmoogle_docker_src_files_path: "{{ matrix_base_data_path }}/postmoogle/docker-src" | |||
| # renovate: datasource=docker depName=registry.gitlab.com/etke.cc/postmoogle | |||
| matrix_bot_postmoogle_version: v0.9.16 | |||
| matrix_bot_postmoogle_version: v0.9.17 | |||
| matrix_bot_postmoogle_docker_image: "{{ matrix_bot_postmoogle_docker_image_name_prefix }}etke.cc/postmoogle:{{ matrix_bot_postmoogle_version }}" | |||
| matrix_bot_postmoogle_docker_image_name_prefix: "{{ 'localhost/' if matrix_bot_postmoogle_container_image_self_build else 'registry.gitlab.com/' }}" | |||
| matrix_bot_postmoogle_docker_image_force_pull: "{{ matrix_bot_postmoogle_docker_image.endswith(':latest') }}" | |||
| @@ -13,7 +13,7 @@ matrix_cactus_comments_client_public_path: "{{ matrix_cactus_comments_client_bas | |||
| matrix_cactus_comments_client_public_path_file_permissions: "0644" | |||
| # renovate: datasource=docker depName=joseluisq/static-web-server | |||
| matrix_cactus_comments_client_version: 2.25.0 | |||
| matrix_cactus_comments_client_version: 2.27.0 | |||
| matrix_cactus_comments_client_container_image: "{{ matrix_container_global_registry_prefix }}joseluisq/static-web-server:{{ matrix_cactus_comments_client_container_image_tag }}" | |||
| matrix_cactus_comments_client_container_image_tag: "{{ 'latest' if matrix_cactus_comments_client_version == 'latest' else (matrix_cactus_comments_client_version + '-alpine') }}" | |||
| @@ -11,7 +11,7 @@ matrix_client_element_container_image_self_build_repo: "https://github.com/eleme | |||
| matrix_client_element_container_image_self_build_low_memory_system_patch_enabled: "{{ ansible_memtotal_mb < 4096 }}" | |||
| # renovate: datasource=docker depName=vectorim/element-web | |||
| matrix_client_element_version: v1.11.57 | |||
| matrix_client_element_version: v1.11.58 | |||
| matrix_client_element_docker_image: "{{ matrix_client_element_docker_image_name_prefix }}vectorim/element-web:{{ matrix_client_element_version }}" | |||
| matrix_client_element_docker_image_name_prefix: "{{ 'localhost/' if matrix_client_element_container_image_self_build else matrix_container_global_registry_prefix }}" | |||
| @@ -8,7 +8,7 @@ matrix_static_files_enabled: true | |||
| matrix_static_files_identifier: matrix-static-files | |||
| # renovate: datasource=docker depName=joseluisq/static-web-server | |||
| matrix_static_files_version: 2.25.0 | |||
| matrix_static_files_version: 2.27.0 | |||
| matrix_static_files_base_path: "{{ matrix_base_data_path }}/{{ 'static-files' if matrix_static_files_identifier == 'matrix-static-files' else matrix_static_files_identifier }}" | |||
| matrix_static_files_config_path: "{{ matrix_static_files_base_path }}/config" | |||
| @@ -83,6 +83,7 @@ matrix_static_files_container_labels_base_domain_traefik_tls: "{{ matrix_static_ | |||
| matrix_static_files_container_labels_base_domain_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming | |||
| # Controls whether the root path (/) at the base domain would respond with a redirect to some URL. | |||
| matrix_static_files_container_labels_base_domain_root_path_redirection_enabled: false | |||
| matrix_static_files_container_labels_base_domain_root_path_redirection_regex: "^https://{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}{{ matrix_static_files_container_labels_base_domain_traefik_path_prefix }}$" | |||
| matrix_static_files_container_labels_base_domain_root_path_redirection_url: "" | |||
| # matrix_static_files_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. | |||
| @@ -59,9 +59,9 @@ traefik.http.routers.{{ matrix_static_files_identifier }}-well-known.tls.certRes | |||
| {% set middlewares = [] %} | |||
| {% if matrix_static_files_container_labels_base_domain_root_path_redirection_enabled %} | |||
| traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.regex=^https://{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}{{ matrix_static_files_container_labels_base_domain_traefik_path_prefix }}$ | |||
| traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} | |||
| {% set middlewares = middlewares + [matrix_static_files_identifier + '-root-path-redirect'] %} | |||
| traefik.http.middlewares.{{ matrix_static_files_identifier }}-base-domain-root-path-redirect.redirectregex.regex={{ matrix_static_files_container_labels_base_domain_root_path_redirection_regex }} | |||
| traefik.http.middlewares.{{ matrix_static_files_identifier }}-base-domain-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} | |||
| {% set middlewares = middlewares + [matrix_static_files_identifier + '-base-domain-root-path-redirect'] %} | |||
| {% endif %} | |||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.rule={{ matrix_static_files_container_labels_base_domain_traefik_rule }} | |||
| @@ -12,7 +12,7 @@ matrix_synapse_admin_container_image_self_build: false | |||
| matrix_synapse_admin_container_image_self_build_repo: "https://github.com/Awesome-Technologies/synapse-admin.git" | |||
| # renovate: datasource=docker depName=awesometechnologies/synapse-admin | |||
| matrix_synapse_admin_version: 0.9.1 | |||
| matrix_synapse_admin_version: 0.8.7 | |||
| matrix_synapse_admin_docker_image: "{{ matrix_synapse_admin_docker_image_name_prefix }}awesometechnologies/synapse-admin:{{ matrix_synapse_admin_version }}" | |||
| matrix_synapse_admin_docker_image_name_prefix: "{{ 'localhost/' if matrix_synapse_admin_container_image_self_build else matrix_container_global_registry_prefix }}" | |||
| matrix_synapse_admin_docker_image_force_pull: "{{ matrix_synapse_admin_docker_image.endswith(':latest') }}" | |||
| @@ -11,7 +11,7 @@ | |||
| matrix_synapse_reverse_proxy_companion_enabled: true | |||
| # renovate: datasource=docker depName=nginx | |||
| matrix_synapse_reverse_proxy_companion_version: 1.25.3-alpine | |||
| matrix_synapse_reverse_proxy_companion_version: 1.25.4-alpine | |||
| matrix_synapse_reverse_proxy_companion_base_path: "{{ matrix_synapse_base_path }}/reverse-proxy-companion" | |||
| matrix_synapse_reverse_proxy_companion_confd_path: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/conf.d" | |||
| @@ -16,7 +16,7 @@ matrix_synapse_enabled: true | |||
| matrix_synapse_github_org_and_repo: element-hq/synapse | |||
| # renovate: datasource=docker depName=ghcr.io/element-hq/synapse | |||
| matrix_synapse_version: v1.100.0 | |||
| matrix_synapse_version: v1.101.0 | |||
| matrix_synapse_username: '' | |||
| matrix_synapse_uid: '' | |||
| @@ -547,8 +547,45 @@ matrix_synapse_event_cache_size: "100K" | |||
| # Controls cache sizes for Synapse. | |||
| # Raise this to increase cache sizes or lower it to potentially lower memory use. | |||
| # To learn more, see: https://github.com/matrix-org/synapse/issues/3939 | |||
| matrix_synapse_caches_global_factor: 0.5 | |||
| # To learn more, see: | |||
| # - https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caching | |||
| # - https://github.com/matrix-org/synapse/issues/3939 | |||
| # Defaults for timings of caches is from https://tcpipuk.github.io/synapse/deployment/synapse.html | |||
| # The idea with the timings used is that you get to evict soon but also you keep stuff around for a long time when its not forced out. | |||
| # Long cache lifetimes together with the low minimum TTL allows autotune to be the primary eviction method assuming size of cache is hit before we hit other caps. | |||
| matrix_synapse_caches_global_factor: 10 | |||
| matrix_synapse_caches_expire_caches: true | |||
| matrix_synapse_caches_cache_entry_ttl: "1080m" | |||
| matrix_synapse_caches_sync_response_cache_duration: "2m" | |||
| # Controls how much memory this role thinks is available for cache-size-related calculations. | |||
| # By default, all of the server's memory is taken into account, but you can adjust this. | |||
| # You can also go for directly adjusting cache-sizes (matrix_synapse_cache_autotuning_max_cache_memory_usage, matrix_synapse_cache_autotuning_target_cache_memory_usage) instead of adjusting this. | |||
| matrix_synapse_cache_size_calculations_memtotal_bytes: "{{ (ansible_memtotal_mb * 1024 * 1024) | int }}" | |||
| # Controls the cap to use for matrix_synapse_cache_autotuning_max_cache_memory_usage. | |||
| matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes: "{{ (2 * 1024 * 1024 * 1024) }}" # 2GB | |||
| # Controls the cap to use for matrix_synapse_cache_autotuning_target_cache_memory_usage. | |||
| matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes: "{{ (1 * 1024 * 1024 * 1024) }}" # 1GB | |||
| matrix_synapse_cache_autotuning_min_cache_ttl: "30s" | |||
| matrix_synapse_cache_autotuning_max_cache_memory_usage: |- | |||
| {{ | |||
| [ | |||
| (((matrix_synapse_cache_size_calculations_memtotal_bytes | int) / 8) | int), | |||
| (matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes | int), | |||
| ] | min | |||
| }} | |||
| matrix_synapse_cache_autotuning_target_cache_memory_usage: |- | |||
| {{ | |||
| [ | |||
| (((matrix_synapse_cache_size_calculations_memtotal_bytes | int) / 16) | int), | |||
| (matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes | int), | |||
| ] | min | |||
| }} | |||
| # Controls whether Synapse will federate at all. | |||
| # Disable this to completely isolate your server from the rest of the Matrix network. | |||
| @@ -89,6 +89,10 @@ | |||
| - {'old': 'matrix_synapse_send_federation', 'new': '<unnecessary - Synapse relies on federation_sender_instances now>'} | |||
| - {'old': 'matrix_synapse_start_pushers', 'new': '<unnecessary - Synapse relies on pusher_instances now>'} | |||
| - {'old': 'matrix_synapse_spam_checker', 'new': '<superseded by matrix_synapse_modules>'} | |||
| - {'old': 'matrix_synapse_caches_autotuning_max_cache_memory_usage', 'new': 'matrix_synapse_cache_autotuning_max_cache_memory_usage'} | |||
| - {'old': 'matrix_synapse_caches_autotuning_target_cache_memory_usage', 'new': 'matrix_synapse_cache_autotuning_target_cache_memory_usage'} | |||
| - {'old': 'matrix_synapse_caches_autotuning_min_cache_ttl', 'new': 'matrix_synapse_cache_autotuning_min_cache_ttl'} | |||
| - {'old': 'matrix_synapse_memtotal_kb', 'new': '<superseded by matrix_synapse_cache_size_calculations_memtotal_bytes>'} | |||
| - name: (Deprecation) Catch and report renamed settings in matrix_synapse_configuration_extension_yaml | |||
| ansible.builtin.fail: | |||
| @@ -760,49 +760,48 @@ federation_domain_whitelist: {{ matrix_synapse_federation_domain_whitelist|to_js | |||
| # The number of events to cache in memory. Not affected by | |||
| # caches.global_factor. | |||
| # | |||
| event_cache_size: "{{ matrix_synapse_event_cache_size }}" | |||
| event_cache_size: {{ matrix_synapse_event_cache_size | to_json }} | |||
| caches: | |||
| # Controls the global cache factor, which is the default cache factor | |||
| # for all caches if a specific factor for that cache is not otherwise | |||
| # set. | |||
| # | |||
| # This can also be set by the "SYNAPSE_CACHE_FACTOR" environment | |||
| # variable. Setting by environment variable takes priority over | |||
| # setting through the config file. | |||
| # | |||
| # Defaults to 0.5, which will half the size of all caches. | |||
| # | |||
| global_factor: {{ matrix_synapse_caches_global_factor }} | |||
| # A dictionary of cache name to cache factor for that individual | |||
| # cache. Overrides the global cache factor for a given cache. | |||
| # | |||
| # These can also be set through environment variables comprised | |||
| # of "SYNAPSE_CACHE_FACTOR_" + the name of the cache in capital | |||
| # letters and underscores. Setting by environment variable | |||
| # takes priority over setting through the config file. | |||
| # Ex. SYNAPSE_CACHE_FACTOR_GET_USERS_WHO_SHARE_ROOM_WITH_USER=2.0 | |||
| # | |||
| # Some caches have '*' and other characters that are not | |||
| # alphanumeric or underscores. These caches can be named with or | |||
| # without the special characters stripped. For example, to specify | |||
| # the cache factor for `*stateGroupCache*` via an environment | |||
| # variable would be `SYNAPSE_CACHE_FACTOR_STATEGROUPCACHE=2.0`. | |||
| # | |||
| per_cache_factors: | |||
| #get_users_who_share_room_with_user: 2.0 | |||
| # Controls the global cache factor, which is the default cache factor | |||
| # for all caches if a specific factor for that cache is not otherwise | |||
| # set. | |||
| # | |||
| # This can also be set by the "SYNAPSE_CACHE_FACTOR" environment | |||
| # variable. Setting by environment variable takes priority over | |||
| # setting through the config file. | |||
| # | |||
| # Defaults to 0.5, which will half the size of all caches. | |||
| # | |||
| global_factor: {{ matrix_synapse_caches_global_factor | to_json }} | |||
| # A dictionary of cache name to cache factor for that individual | |||
| # cache. Overrides the global cache factor for a given cache. | |||
| # | |||
| # These can also be set through environment variables comprised | |||
| # of "SYNAPSE_CACHE_FACTOR_" + the name of the cache in capital | |||
| # letters and underscores. Setting by environment variable | |||
| # takes priority over setting through the config file. | |||
| # Ex. SYNAPSE_CACHE_FACTOR_GET_USERS_WHO_SHARE_ROOM_WITH_USER=2.0 | |||
| # | |||
| # Some caches have '*' and other characters that are not | |||
| # alphanumeric or underscores. These caches can be named with or | |||
| # without the special characters stripped. For example, to specify | |||
| # the cache factor for `*stateGroupCache*` via an environment | |||
| # variable would be `SYNAPSE_CACHE_FACTOR_STATEGROUPCACHE=2.0`. | |||
| # | |||
| per_cache_factors: | |||
| #get_users_who_share_room_with_user: 2.0 | |||
| # Controls whether cache entries are evicted after a specified time | |||
| # period. Defaults to true. Uncomment to disable this feature. | |||
| # | |||
| #expire_caches: false | |||
| expire_caches: {{ matrix_synapse_caches_expire_caches | to_json }} | |||
| # If expire_caches is enabled, this flag controls how long an entry can | |||
| # be in a cache without having been accessed before being evicted. | |||
| # Defaults to 30m. Uncomment to set a different time to live for cache entries. | |||
| # | |||
| #cache_entry_ttl: 30m | |||
| cache_entry_ttl: {{ matrix_synapse_caches_cache_entry_ttl | to_json }} | |||
| # Controls how long the results of a /sync request are cached for after | |||
| # a successful response is returned. A higher duration can help clients with | |||
| @@ -811,7 +810,12 @@ caches: | |||
| # By default, this is zero, which means that sync responses are not cached | |||
| # at all. | |||
| # | |||
| #sync_response_cache_duration: 2m | |||
| sync_response_cache_duration: {{ matrix_synapse_caches_sync_response_cache_duration | to_json }} | |||
| cache_autotuning: | |||
| max_cache_memory_usage: {{ ((matrix_synapse_cache_autotuning_max_cache_memory_usage | int | to_json) if matrix_synapse_cache_autotuning_max_cache_memory_usage else '') }} | |||
| target_cache_memory_usage: {{ ((matrix_synapse_cache_autotuning_target_cache_memory_usage | int | to_json) if matrix_synapse_cache_autotuning_target_cache_memory_usage else '') }} | |||
| min_cache_ttl: {{ matrix_synapse_cache_autotuning_min_cache_ttl | to_json }} | |||
| ## Database ## | |||