diff --git a/docs/production/system-configuration.md b/docs/production/system-configuration.md index d73bf54a29..430a355fe6 100644 --- a/docs/production/system-configuration.md +++ b/docs/production/system-configuration.md @@ -306,6 +306,12 @@ Override the maximum size that an item in memcached can store. This defaults to 1m; adjusting it should only be necessary if your Zulip server has organizations which have more than 20k users. +#### `size_reporting` + +Set to a true value to enable object size reporting in memcached. This incurs a +small overhead for every store or delete operation, but allows a +memcached_exporter to report precise item size distribution. + ### `[loadbalancer]` #### `ips` diff --git a/puppet/zulip/manifests/profile/memcached.pp b/puppet/zulip/manifests/profile/memcached.pp index a484965579..0c93143775 100644 --- a/puppet/zulip/manifests/profile/memcached.pp +++ b/puppet/zulip/manifests/profile/memcached.pp @@ -18,6 +18,7 @@ class zulip::profile::memcached { package { $memcached_packages: ensure => installed } $memcached_max_item_size = zulipconf('memcached', 'max_item_size', '1m') + $memcached_size_reporting = zulipconf('memcached', 'size_reporting', false) $memcached_memory = zulipconf('memcached', 'memory', $zulip::common::total_memory_mb / 8) file { '/etc/sasl2': ensure => directory, diff --git a/puppet/zulip/templates/memcached.conf.template.erb b/puppet/zulip/templates/memcached.conf.template.erb index bd8c5dff9c..5f0f4e351e 100644 --- a/puppet/zulip/templates/memcached.conf.template.erb +++ b/puppet/zulip/templates/memcached.conf.template.erb @@ -55,3 +55,7 @@ logfile /var/log/memcached.log # Larger max-item-size -I <%= @memcached_max_item_size %> <% end -%> +<%- if @memcached_size_reporting %> +# Enable `stats sizes` (see https://github.com/memcached/memcached/blob/master/doc/protocol.txt) +-o track_sizes +<% end -%>