diff --git a/charts/synapse/.helmignore b/charts/synapse/.helmignore new file mode 100644 index 0000000..3b78ac1 --- /dev/null +++ b/charts/synapse/.helmignore @@ -0,0 +1,29 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# additional files +README.md +# fix and remove +NOTES.txt +tests/ +docker/ diff --git a/charts/synapse/Chart.yaml b/charts/synapse/Chart.yaml index 4a73807..3be9f3b 100644 --- a/charts/synapse/Chart.yaml +++ b/charts/synapse/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: synapse description: matrix synapse kubernetes deployment -version: 2.2.1 +version: 2.3.0 appVersion: 1.151.0 diff --git a/charts/synapse/templates/_helpers.tpl b/charts/synapse/templates/_helpers.tpl index 18a87d9..26fdef9 100644 --- a/charts/synapse/templates/_helpers.tpl +++ b/charts/synapse/templates/_helpers.tpl @@ -64,6 +64,50 @@ app: synapse component: synapse-{{ . }} {{- end }} +{{/* +Base helper for Synapse cache size limits. +Falls back to .fallback when no limit is configured or suffix is unrecognised. +Supported Kubernetes suffixes: Gi, Mi, G, M. +*/}} +{{- define "synapse.workerCacheMemory" -}} +{{- $resources := .options.resources | default .defaults -}} +{{- $memLimit := "" -}} +{{- if and $resources $resources.limits $resources.limits.memory -}} + {{- $memLimit = $resources.limits.memory | toString -}} +{{- end -}} +{{- $num := .num -}} +{{- $denom := .denom -}} +{{- if $memLimit -}} + {{- if hasSuffix "Gi" $memLimit -}} + {{- $val := trimSuffix "Gi" $memLimit | int64 -}} + {{- printf "%dM" (div (mul (mul $val 1024) $num) $denom) -}} + {{- else if hasSuffix "Mi" $memLimit -}} + {{- $val := trimSuffix "Mi" $memLimit | int64 -}} + {{- printf "%dM" (div (mul $val $num) $denom) -}} + {{- else if hasSuffix "G" $memLimit -}} + {{- $val := trimSuffix "G" $memLimit | int64 -}} + {{- printf "%dM" (div (mul (mul $val 1024) $num) $denom) -}} + {{- else if hasSuffix "M" $memLimit -}} + {{- $val := trimSuffix "M" $memLimit | int64 -}} + {{- printf "%dM" (div (mul $val $num) $denom) -}} + {{- else -}} + {{- .fallback -}} + {{- end -}} +{{- else -}} + {{- .fallback -}} +{{- end -}} +{{- end -}} + +{{/* max_cache_memory_usage = 90% of memory limit */}} +{{- define "synapse.workerMaxCacheMemory" -}} +{{- include "synapse.workerCacheMemory" (merge (dict "num" 9 "denom" 10) .) -}} +{{- end -}} + +{{/* target_cache_memory_usage = 80% of max = 72% of memory limit */}} +{{- define "synapse.workerTargetCacheMemory" -}} +{{- include "synapse.workerCacheMemory" (merge (dict "num" 72 "denom" 100) .) -}} +{{- end -}} + {{/* Workers containers */}} diff --git a/charts/synapse/templates/synapse-secret.yaml b/charts/synapse/templates/synapse-secret.yaml index 030d387..e3d7fcf 100644 --- a/charts/synapse/templates/synapse-secret.yaml +++ b/charts/synapse/templates/synapse-secret.yaml @@ -351,8 +351,8 @@ stringData: cache_entry_ttl: {{ $.Values.synapse.caches.cacheEntryTtl }} sync_response_cache_duration: {{ $.Values.synapse.caches.syncResponseCacheDuration }} cache_autotuning: - max_cache_memory_usage: {{ $.Values.synapse.cacheAutotuning.maxCacheMemoryUsage }} - target_cache_memory_usage: {{ $.Values.synapse.cacheAutotuning.targetCacheMemoryUsage }} + max_cache_memory_usage: {{ include "synapse.workerMaxCacheMemory" (dict "options" $options "defaults" $.Values.synapse.resourcesDefaults "fallback" $.Values.synapse.cacheAutotuning.maxCacheMemoryUsage) }} + target_cache_memory_usage: {{ include "synapse.workerTargetCacheMemory" (dict "options" $options "defaults" $.Values.synapse.resourcesDefaults "fallback" $.Values.synapse.cacheAutotuning.targetCacheMemoryUsage) }} min_cache_ttl: {{ $.Values.synapse.cacheAutotuning.minCacheTtl }} {{- if $.Values.synapse.opentracing.enabled }} opentracing: diff --git a/charts/synapse/tests/golden/fixtures/test-ingress-default.golden.yaml b/charts/synapse/tests/golden/fixtures/test-ingress-default.golden.yaml index d43f8f6..b4c0a1f 100644 --- a/charts/synapse/tests/golden/fixtures/test-ingress-default.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-ingress-default.golden.yaml @@ -95,7 +95,7 @@ spec: port: number: 80 name: synapse-presence - - path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ + - path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/ pathType: ImplementationSpecific backend: service: diff --git a/charts/synapse/tests/golden/fixtures/test-ingress-msc4306.golden.yaml b/charts/synapse/tests/golden/fixtures/test-ingress-msc4306.golden.yaml index 6d708fd..7ed33f0 100644 --- a/charts/synapse/tests/golden/fixtures/test-ingress-msc4306.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-ingress-msc4306.golden.yaml @@ -95,7 +95,7 @@ spec: port: number: 80 name: synapse-presence - - path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ + - path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/ pathType: ImplementationSpecific backend: service: diff --git a/charts/synapse/tests/golden/fixtures/test-ingress-no-mas.golden.yaml b/charts/synapse/tests/golden/fixtures/test-ingress-no-mas.golden.yaml index 27f146a..9e193a5 100644 --- a/charts/synapse/tests/golden/fixtures/test-ingress-no-mas.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-ingress-no-mas.golden.yaml @@ -95,7 +95,7 @@ spec: port: number: 80 name: synapse-presence - - path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ + - path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/ pathType: ImplementationSpecific backend: service: diff --git a/charts/synapse/tests/golden/fixtures/test-synapse-secret-no-pgbouncer-stream-writers.golden.yaml b/charts/synapse/tests/golden/fixtures/test-synapse-secret-no-pgbouncer-stream-writers.golden.yaml index d8d6de3..1c1f258 100644 --- a/charts/synapse/tests/golden/fixtures/test-synapse-secret-no-pgbouncer-stream-writers.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-synapse-secret-no-pgbouncer-stream-writers.golden.yaml @@ -223,12 +223,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -473,12 +473,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -731,12 +731,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -814,7 +814,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -996,12 +996,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1079,7 +1079,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -1261,12 +1261,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1519,12 +1519,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1784,12 +1784,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1866,7 +1866,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -2048,12 +2048,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2308,12 +2308,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2568,12 +2568,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2651,7 +2651,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -2833,12 +2833,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2916,7 +2916,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -3098,12 +3098,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3348,12 +3348,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3431,7 +3431,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -3613,12 +3613,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3871,12 +3871,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4129,12 +4129,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4212,7 +4212,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -4394,12 +4394,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4477,7 +4477,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -4659,12 +4659,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4742,7 +4742,7 @@ stringData: cp_max: 50 cp_min: 5 database: synapse - host: NOT-CONFIGURED4 + host: synapse-pgbouncer password: NOT-CONFIGURED user: synapse name: psycopg2 @@ -4924,12 +4924,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -5182,12 +5182,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ diff --git a/charts/synapse/tests/golden/fixtures/test-synapse-secret.golden.yaml b/charts/synapse/tests/golden/fixtures/test-synapse-secret.golden.yaml index 7432b5c..da1cfeb 100644 --- a/charts/synapse/tests/golden/fixtures/test-synapse-secret.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-synapse-secret.golden.yaml @@ -223,12 +223,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -473,12 +473,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -731,12 +731,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -996,12 +996,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1261,12 +1261,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1519,12 +1519,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -1784,12 +1784,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2048,12 +2048,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2308,12 +2308,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2568,12 +2568,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -2833,12 +2833,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3098,12 +3098,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3348,12 +3348,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3613,12 +3613,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -3871,12 +3871,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4129,12 +4129,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4394,12 +4394,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4659,12 +4659,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -4924,12 +4924,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ @@ -5182,12 +5182,12 @@ stringData: msc3967_enabled: true caches: expire_caches: true - global_factor: 1 + global_factor: 0.5 cache_entry_ttl: 30m sync_response_cache_duration: 2m cache_autotuning: - max_cache_memory_usage: 1024M - target_cache_memory_usage: 512M + max_cache_memory_usage: 1843M + target_cache_memory_usage: 1474M min_cache_ttl: 5m opentracing: ~ diff --git a/charts/synapse/tests/golden/fixtures/test-synapse-workers-deployment.golden.yaml b/charts/synapse/tests/golden/fixtures/test-synapse-workers-deployment.golden.yaml index eba4e2e..72ae0d3 100644 --- a/charts/synapse/tests/golden/fixtures/test-synapse-workers-deployment.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-synapse-workers-deployment.golden.yaml @@ -24,7 +24,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-client-reader @@ -101,7 +101,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-federation-reader @@ -178,7 +178,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-media-repository @@ -255,7 +255,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-room @@ -332,7 +332,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-sync diff --git a/charts/synapse/tests/golden/fixtures/test-synapse-workers-statefulset.golden.yaml b/charts/synapse/tests/golden/fixtures/test-synapse-workers-statefulset.golden.yaml index ed84225..23049ed 100644 --- a/charts/synapse/tests/golden/fixtures/test-synapse-workers-statefulset.golden.yaml +++ b/charts/synapse/tests/golden/fixtures/test-synapse-workers-statefulset.golden.yaml @@ -20,7 +20,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-account-data @@ -93,7 +93,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-background-worker @@ -149,7 +149,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-device-lists @@ -222,7 +222,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-event-persister @@ -278,7 +278,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-federation-sender @@ -351,7 +351,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-master @@ -421,7 +421,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-media-repository-background-jobs @@ -494,7 +494,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-presence @@ -567,7 +567,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-push-rules @@ -640,7 +640,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-pusher @@ -696,7 +696,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-receipts @@ -769,7 +769,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-thread-subscriptions @@ -842,7 +842,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-to-device @@ -915,7 +915,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-typing @@ -988,7 +988,7 @@ spec: prometheus.io/port: "9092" prometheus.io/scrape: "true" prometheus.io/path: "/_synapse/metrics" - checksum/secret: 55eaa481070eecc9b744e9e2a271713877f974d548a1ad903478d45358d367a7 + checksum/secret: b138e130fcb0cbf9fa445398ca93dc7e9f6d7123b0463e24016fbfed7a3bbfb2 labels: app: synapse component: synapse-user-dir diff --git a/charts/synapse/values.yaml b/charts/synapse/values.yaml index b8bc184..3aaec5d 100644 --- a/charts/synapse/values.yaml +++ b/charts/synapse/values.yaml @@ -1,64 +1,4 @@ --- -# the core of synapse monolith distribution is complex regexp routing to particular workers -# workers types: -# 1. synapse.app.generic_worker: -# most common worker type, can read data, respond to http api, clients and federation -# requests, can read data, have no streams, can not wrie any strem by itself -# generic worker can be: -# - reader (client_reader, federation_reader, sync, room) -# - stream writer (if configured in stream_writers section) -# - both of them -# this generic_worker not an architecture type, this is behavior type based on config -# 2. stream writer: -# not a separate type, this is role for generic worker, if worker is in stream_writers section -# this worker writes redis stream exclusively and other workers writes the strim -# by requesting http to it -# stream writer must: -# - be in instance_map -# - have replication listener (port 9093) -# - some of the streams are singleton: -# (typing, to_device, account_data, presence, push_rules), -# - some of stream writers are scalable and ready for round-robin requests: -# (receipts, device_lists, thread_subscriptions, quarantined_media, events) -# 3. synapse.app.media_repository: -# the only real worker app type, different from generic_worker: -# - media-specific headers -# - responds for /_matrix/media/, /_matrix/client/v1/media/, /_matrix/federation/v1/media/ -# - can have backgrounf job media_instance_running_background_jobs -# - can not be a stream writer -# - can not respond to any client/federation endpoints -# 4. background jobs: -# this is generic workers, that has no http endpoints to respond -# the are: -# - background: singleton for stats, media cleanup, user directory updates -# - pusher: `pusher_instances: [pusher1, pusher2]`, sends push-notifications -# - federation_sender: `federation_sender_instances: [sender1, sender2]`, output federation only -# -------------------------------------------------------------------------------------------------------- -# | worker | type | scalable | possible lb algo | http | -# -------------------------------------------------------------------------------------------------------- -# │ typing │ stream writer │ no │ - │ yes | -# │ to_device │ stream writer │ no │ - │ yes | -# │ account_data │ stream writer │ no │ - │ yes | -# │ presence │ stream writer │ no │ - │ yes | -# │ push_rules │ stream writer │ no │ - │ yes | -# │ receipts │ stream writer │ yes │ round-robin │ yes | -# │ device_lists │ stream writer │ yes │ round-robin │ yes | -# │ thread_subscriptions │ stream writer │ yes │ round-robin │ yes | -# │ quarantined_media │ stream writer │ yes │ round-robin │ yes | -# │ events (persister) │ stream writer │ yes │ shard by room_id │ yes | -# │ media_repository │ app │ yes │ least_conn │ yes | -# │ media_instance_running_background_jobs │ app │ no │ no │ no | -# │ room_worker │ generic │ yes │ hash by room_id │ yes | -# │ sync_worker │ generic │ yes │ hash by user_id │ yes | -# │ federation_reader │ generic │ yes │ hash by source ip │ yes | -# │ client_reader │ generic │ yes │ least_conn │ yes | -# │ user_dir │ generic │ no │ - │ yes | -# │ background_worker │ generic │ no │ - │ no | -# │ pusher │ generic │ yes │ shard by user │ no | -# │ federation_sender │ generic │ yes │ shard by destination │ no | - -clusterDnsDomain: cluster.local - synapse: serverName: NOT-CONFIGURED matrixAuthenticationServiceEndpoint: '' @@ -75,7 +15,7 @@ synapse: repository: "ghcr.io/code-tool/matrix-stack/synapse" # this is patched version of mainstream synamse # please find patches by link: https://github.com/code-tool/matrix-stack/tree/main/build - # also this ghcr contains synapse:v1.146.0-e2e-optimized with e2e_room_key query patches + # also this ghcr contains synapse:v1.151.0-e2e-optimized with e2e_room_key query patches tag: "v1.151.0" pullPolicy: IfNotPresent disablePgBouncerForStreamWriters: false @@ -103,8 +43,8 @@ synapse: kedaAutoscaling: enabled: false timezone: "Europe/Kyiv" - start: "0 9 * * *" - end: "0 19 * * *" + start: "30 8 * * *" + end: "30 20 * * *" desiredReplicas: 5 minReplicaCount: 2 autoscaling: @@ -119,8 +59,8 @@ synapse: kedaAutoscaling: enabled: false timezone: "Europe/Kyiv" - start: "0 9 * * *" - end: "0 19 * * *" + start: "30 8 * * *" + end: "30 20 * * *" desiredReplicas: 10 minReplicaCount: 3 autoscaling: @@ -134,8 +74,8 @@ synapse: kedaAutoscaling: enabled: false timezone: "Europe/Kyiv" - start: "0 9 * * *" - end: "0 19 * * *" + start: "30 8 * * *" + end: "30 20 * * *" desiredReplicas: 5 minReplicaCount: 2 # HPA @@ -150,8 +90,8 @@ synapse: kedaAutoscaling: enabled: false timezone: "Europe/Kyiv" - start: "0 9 * * *" - end: "0 19 * * *" + start: "30 8 * * *" + end: "30 20 * * *" desiredReplicas: 15 minReplicaCount: 5 # HPA @@ -166,8 +106,8 @@ synapse: kedaAutoscaling: enabled: false timezone: "Europe/Kyiv" - start: "0 9 * * *" - end: "0 19 * * *" + start: "30 8 * * *" + end: "30 20 * * *" desiredReplicas: 5 minReplicaCount: 2 # HPA @@ -338,7 +278,7 @@ synapse: eventCacheSize: '10K' # https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#caches caches: - globalFactor: 1.0 + globalFactor: 0.5 cacheEntryTtl: '30m' syncResponseCacheDuration: '2m' cacheAutotuning: @@ -476,7 +416,10 @@ ingress: # routes to push_rules stream writer singleton worker # source: push_rule.py:51 client_patterns("/pushrules/...", v1=True) -> (api/v1|r0|v3|unstable) pushRulesRoutes: - - "/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/" + # short version + #- "/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/" + # long version because of ingress + - "/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/" # https://element-hq.github.io/synapse/latest/workers.html#the-device_lists-stream # routes to device_lists stream writer multiple workers # source: devices.py:79 client_patterns("/delete_devices") -> (r0|v3|unstable)