Ema has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/385378 )
Change subject: cache: set varnish runtime parameters via hiera ...................................................................... cache: set varnish runtime parameters via hiera Introduce two new hiera settings under profile::cache::base, fe_runtime_params and be_runtime_params, allowing to specify varnish runtime parameters (varnishd -p) for varnish frontends and backends respectively. Bug: T159429 Change-Id: I0d4b3fd482dc45326d47e88185383684320fb844 --- M hieradata/labs.yaml M hieradata/role/common/cache/misc.yaml M hieradata/role/common/cache/text.yaml M hieradata/role/common/cache/upload.yaml M modules/cacheproxy/manifests/instance_pair.pp M modules/profile/manifests/cache/base.pp M modules/profile/manifests/cache/misc.pp M modules/profile/manifests/cache/text.pp M modules/profile/manifests/cache/upload.pp M modules/varnish/manifests/common.pp M modules/varnish/manifests/instance.pp 11 files changed, 30 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/78/385378/1 diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml index 0e229d6..caa3fdd 100644 --- a/hieradata/labs.yaml +++ b/hieradata/labs.yaml @@ -63,6 +63,11 @@ profile::cache::base::zero_site: 'https://zero.wikimedia.beta.wmflabs.org' profile::cache::base::purge_host_only_upload_re: '^(upload|maps)\.beta\.wmflabs\.org$' profile::cache::base::purge_host_not_upload_re: '^(?!(upload|maps)\.beta\.wmflabs\.org)' +profile::cache::base::fe_runtime_params: + - default_ttl=3600 +profile::cache::base::be_runtime_params: + - default_ttl=3600 + - timeout_idle=120 # Profile::cache::ssl::unified profile::cache::ssl::unified::monitoring: false profile::cache::ssl::unified::letsencrypt: true diff --git a/hieradata/role/common/cache/misc.yaml b/hieradata/role/common/cache/misc.yaml index c596edd..32d358f 100644 --- a/hieradata/role/common/cache/misc.yaml +++ b/hieradata/role/common/cache/misc.yaml @@ -279,6 +279,13 @@ profile::cache::base::purge_host_only_upload_re: '^(upload|maps)\.wikimedia\.org$' profile::cache::base::purge_host_not_upload_re: '^(?!(upload|maps)\.wikimedia\.org)' profile::cache::base::storage_parts: ['sda3', 'sdb3'] +profile::cache::base::fe_runtime_params: + - default_ttl=3600 +profile::cache::base::be_runtime_params: + - default_ttl=3600 + - timeout_idle=120 + - nuke_limit=1000 + - lru_interval=31 # Profile::cache::ssl::unified profile::cache::ssl::unified::monitoring: true profile::cache::ssl::unified::letsencrypt: false diff --git a/hieradata/role/common/cache/text.yaml b/hieradata/role/common/cache/text.yaml index 8a8d6ba..75493f7 100644 --- a/hieradata/role/common/cache/text.yaml +++ b/hieradata/role/common/cache/text.yaml @@ -83,6 +83,10 @@ profile::cache::base::purge_host_only_upload_re: '^(upload|maps)\.wikimedia\.org$' profile::cache::base::purge_host_not_upload_re: '^(?!(upload|maps)\.wikimedia\.org)' profile::cache::base::storage_parts: ['sda3', 'sdb3'] +profile::cache::base::fe_runtime_params: + - default_ttl=86400 +profile::cache::base::be_runtime_params: + - default_ttl=86400 # Profile::cache::ssl::unified profile::cache::ssl::unified::monitoring: true profile::cache::ssl::unified::letsencrypt: false diff --git a/hieradata/role/common/cache/upload.yaml b/hieradata/role/common/cache/upload.yaml index 4fa61ae..2b83799 100644 --- a/hieradata/role/common/cache/upload.yaml +++ b/hieradata/role/common/cache/upload.yaml @@ -55,6 +55,10 @@ profile::cache::base::purge_host_only_upload_re: '^(upload|maps)\.wikimedia\.org$' profile::cache::base::purge_host_not_upload_re: '^(?!(upload|maps)\.wikimedia\.org)' profile::cache::base::storage_parts: ['sda3', 'sdb3'] +profile::cache::base::fe_runtime_params: + - default_ttl=86400 +profile::cache::base::be_runtime_params: + - default_ttl=86400 # Profile::cache::ssl::unified profile::cache::ssl::unified::monitoring: true profile::cache::ssl::unified::letsencrypt: false diff --git a/modules/cacheproxy/manifests/instance_pair.pp b/modules/cacheproxy/manifests/instance_pair.pp index f1c5c59..2a50029 100644 --- a/modules/cacheproxy/manifests/instance_pair.pp +++ b/modules/cacheproxy/manifests/instance_pair.pp @@ -2,8 +2,6 @@ class cacheproxy::instance_pair ( $cache_type, $fe_jemalloc_conf, - $fe_runtime_params, - $be_runtime_params, $app_directors, $app_def_be_opts, $fe_vcl_config, @@ -106,7 +104,6 @@ extra_vcl => $be_extra_vcl, ports => [ '3128' ], admin_port => 6083, - runtime_parameters => concat($be_runtime_params, $nuke_lru_params, $exp_thread_params), storage => "${be_storage} ${be_transient_storage}", vcl_config => $be_warming_vcl_config, app_directors => $app_directors, @@ -132,7 +129,6 @@ extra_vcl => $fe_extra_vcl, ports => [ '80', '3120', '3121', '3122', '3123', '3124', '3125', '3126', '3127' ], admin_port => 6082, - runtime_parameters => $fe_runtime_params, storage => "-s malloc,${fe_mem_gb}G ${fe_transient_storage}", jemalloc_conf => $fe_jemalloc_conf, backend_caches => { diff --git a/modules/profile/manifests/cache/base.pp b/modules/profile/manifests/cache/base.pp index 447e69a..c3ff1bb 100644 --- a/modules/profile/manifests/cache/base.pp +++ b/modules/profile/manifests/cache/base.pp @@ -15,6 +15,8 @@ $storage_parts = hiera('profile::cache::base::purge_host_not_upload_re'), $packages_version = hiera('profile::cache::base::packages_version', 'installed'), $varnish_version = hiera('profile::cache::base::varnish_version', 4), + $fe_runtime_params = hiera('profile::cache::base::fe_runtime_params', []), + $be_runtime_params = hiera('profile::cache::base::be_runtime_params', []), ) { # There is no better way to do this, so it can't be a class parameter. In fact, # I consider our requirement to make hiera calls parameters @@ -58,7 +60,9 @@ } class { '::varnish::common': - varnish_version => $varnish_version, + varnish_version => $varnish_version, + fe_runtime_params => $fe_runtime_params, + be_runtime_params => $be_runtime_params, } class { [ diff --git a/modules/profile/manifests/cache/misc.pp b/modules/profile/manifests/cache/misc.pp index f5bfbd1..a6a3715 100644 --- a/modules/profile/manifests/cache/misc.pp +++ b/modules/profile/manifests/cache/misc.pp @@ -46,17 +46,9 @@ 'req_handling' => $req_handling, } - $common_runtime_params = ['default_ttl=3600'] - - # The default timeout_idle setting, 5s, seems to be causing sc_rx_timeout - # issues in our setup. See T159429 - $be_runtime_params = ['timeout_idle=120'] - class { 'cacheproxy::instance_pair': cache_type => 'misc', fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk:16', - fe_runtime_params => $common_runtime_params, - be_runtime_params => concat($common_runtime_params, $be_runtime_params), app_directors => $app_directors, app_def_be_opts => $app_def_be_opts, fe_vcl_config => $common_vcl_config, diff --git a/modules/profile/manifests/cache/text.pp b/modules/profile/manifests/cache/text.pp index 0e79b33..2cdcfba 100644 --- a/modules/profile/manifests/cache/text.pp +++ b/modules/profile/manifests/cache/text.pp @@ -64,15 +64,11 @@ 'enable_geoiplookup' => true, }) - $common_runtime_params = ['default_ttl=86400'] - $text_storage_args = $::profile::cache::base::file_storage_args class { 'cacheproxy::instance_pair': cache_type => 'text', fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk:16', - fe_runtime_params => $common_runtime_params, - be_runtime_params => $common_runtime_params, app_directors => $app_directors, app_def_be_opts => $app_def_be_opts, fe_vcl_config => $fe_vcl_config, diff --git a/modules/profile/manifests/cache/upload.pp b/modules/profile/manifests/cache/upload.pp index ea3978a..d230442 100644 --- a/modules/profile/manifests/cache/upload.pp +++ b/modules/profile/manifests/cache/upload.pp @@ -80,13 +80,9 @@ "-s bin4=file,/srv/${sda}/varnish.bin4,${bin4_size}M", ], ' ') - $common_runtime_params = ['default_ttl=86400'] - class { 'cacheproxy::instance_pair': cache_type => 'upload', fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk:17', - fe_runtime_params => $common_runtime_params, - be_runtime_params => $common_runtime_params, app_directors => $app_directors, app_def_be_opts => $app_def_be_opts, fe_vcl_config => $fe_vcl_config, diff --git a/modules/varnish/manifests/common.pp b/modules/varnish/manifests/common.pp index d8ec92c..3603e09 100644 --- a/modules/varnish/manifests/common.pp +++ b/modules/varnish/manifests/common.pp @@ -1,4 +1,4 @@ -class varnish::common($varnish_version=4) { +class varnish::common($varnish_version=4, $fe_runtime_params=[], $be_runtime_params=[]) { require ::varnish::packages # Mount /var/lib/varnish as tmpfs to avoid Linux flushing mlocked diff --git a/modules/varnish/manifests/instance.pp b/modules/varnish/manifests/instance.pp index 3f0462e..7d1086f 100644 --- a/modules/varnish/manifests/instance.pp +++ b/modules/varnish/manifests/instance.pp @@ -7,7 +7,6 @@ $vcl = '', $storage='-s malloc,1G', $jemalloc_conf=undef, - $runtime_parameters=[], $app_directors={}, $app_def_be_opts={}, $backend_caches={}, @@ -17,7 +16,6 @@ include ::varnish::common - $runtime_params = join(prefix($runtime_parameters, '-p '), ' ') if $instance_name == '' { $instancesuffix = '' $extraopts = '' @@ -40,10 +38,14 @@ # Write the dynamic backend caches configuration, if we need it if $instance_name == '' { $inst = 'backend' + $runtime_parameters = $::varnish::common::be_runtime_params } else { $inst = $instance_name + $runtime_parameters = $::varnish::common::fe_runtime_params } + $runtime_params = join(prefix($runtime_parameters, '-p '), ' ') + varnish::common::directors { $vcl: instance => $inst, directors => $backend_caches, -- To view, visit https://gerrit.wikimedia.org/r/385378 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0d4b3fd482dc45326d47e88185383684320fb844 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ema <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
