From 209b022385c3454687ac355052f80c9c034ffe11 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Thu, 4 Feb 2016 13:58:38 +1100 Subject: [PATCH] PERF: cut down on memory usage allowed to redis This limits the amount of backlog message bus channels can have. --- config/discourse_defaults.conf | 5 +++++ config/initializers/004-message_bus.rb | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf index 9488d807f7c..19c1ce63d1b 100644 --- a/config/discourse_defaults.conf +++ b/config/discourse_defaults.conf @@ -130,3 +130,8 @@ connection_reaper_max_age = 600 # IMPORTANT: path must not include a trailing / # EG: /forum relative_url_root = + +# increasing this number will increase redis memory use +# this ensures backlog (ability of channels to catch up are capped) +# message bus default cap is 1000, we are winding it down to 100 +message_bus_max_backlog_size = 100 diff --git a/config/initializers/004-message_bus.rb b/config/initializers/004-message_bus.rb index 940ae75a179..41d5386c5f7 100644 --- a/config/initializers/004-message_bus.rb +++ b/config/initializers/004-message_bus.rb @@ -71,11 +71,10 @@ end # Point at our redis MessageBus.redis_config = GlobalSetting.redis_config +MessageBus.reliable_pub_sub.max_backlog_size = GlobalSetting.message_bus_max_backlog_size MessageBus.long_polling_enabled = SiteSetting.enable_long_polling MessageBus.long_polling_interval = SiteSetting.long_polling_interval - - MessageBus.cache_assets = !Rails.env.development? MessageBus.enable_diagnostics