Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Base PostgreSQL tuning on if the frontend is on the same host.

Alex Vandiver5bc75a94be79
diff --git a/puppet/zulip/manifests/profile/postgresql.pp b/puppet/zulip/manifests/profile/postgresql.pp
index 33d5a3bb875..88e4f5c842a 100644
--- a/puppet/zulip/manifests/profile/postgresql.pp
+++ b/puppet/zulip/manifests/profile/postgresql.pp
@@ -4,10 +4,16 @@ class zulip::profile::postgresql {
include zulip::postgresql_base
$version = $zulip::postgresql_common::version
- $work_mem = $zulip::common::total_memory_mb / 512
- $shared_buffers = $zulip::common::total_memory_mb / 8
- $effective_cache_size = $zulip::common::total_memory_mb * 10 / 32
- $maintenance_work_mem = $zulip::common::total_memory_mb / 32
+
+ if defined(Class['zulip::app_frontend_base']) {
+ $total_postgres_memory_mb = zulipconf('postgresql', 'memory', $zulip::common::total_memory_mb / 2)
+ } else {
+ $total_postgres_memory_mb = zulipconf('postgresql', 'memory', $zulip::common::total_memory_mb)
+ }
+ $work_mem = $total_postgres_memory_mb / 256
+ $shared_buffers = $total_postgres_memory_mb / 4
+ $effective_cache_size = $total_postgres_memory_mb * 10 / 16
+ $maintenance_work_mem = $total_postgres_memory_mb / 16
$random_page_cost = zulipconf('postgresql', 'random_page_cost', undef)
$effective_io_concurrency = zulipconf('postgresql', 'effective_io_concurrency', undef)