BBlack has submitted this change and it was merged.
Change subject: varnish: jemalloc tuning for frontend caches
......................................................................
varnish: jemalloc tuning for frontend caches
This should reduce the virtual and resident waste/overhead when
configuring frontend malloc storage with large fractions of total
memory. Note that the chunk size could probably use further
tuning per-cluster, but the values in this patch are reasonable
conservative estimates from some basic experimentation/research.
Bug: T135384
Change-Id: Ie0bdcbf6a0290b76131a6a43c3013d72b653100f
---
M modules/role/manifests/cache/instances.pp
M modules/role/manifests/cache/maps.pp
M modules/role/manifests/cache/misc.pp
M modules/role/manifests/cache/text.pp
M modules/role/manifests/cache/upload.pp
M modules/varnish/manifests/instance.pp
M modules/varnish/templates/initscripts/varnish.systemd.erb
7 files changed, 10 insertions(+), 0 deletions(-)
Approvals:
BBlack: Verified; Looks good to me, approved
diff --git a/modules/role/manifests/cache/instances.pp
b/modules/role/manifests/cache/instances.pp
index 0535d83..2bf7d03 100644
--- a/modules/role/manifests/cache/instances.pp
+++ b/modules/role/manifests/cache/instances.pp
@@ -1,6 +1,7 @@
# This defines the pair of varnish::instance for a 2layer/2tier cache cluster
define role::cache::instances (
$fe_mem_gb,
+ $fe_jemalloc_conf,
$runtime_params,
$app_directors,
$app_be_opts,
@@ -101,6 +102,7 @@
admin_port => 6082,
runtime_parameters => $runtime_params,
storage => "-s malloc,${fe_mem_gb}G",
+ jemalloc_conf => $fe_jemalloc_conf,
directors => {
'cache_local' => {
'dynamic' => 'yes',
diff --git a/modules/role/manifests/cache/maps.pp
b/modules/role/manifests/cache/maps.pp
index adb6889..b6acb58 100644
--- a/modules/role/manifests/cache/maps.pp
+++ b/modules/role/manifests/cache/maps.pp
@@ -53,6 +53,7 @@
role::cache::instances { 'maps':
fe_mem_gb => ceiling(0.5 * $::memorysize_mb / 1024.0),
+ fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk_size:17',
runtime_params => ['default_ttl=86400'],
app_directors => $app_directors,
app_be_opts => [],
diff --git a/modules/role/manifests/cache/misc.pp
b/modules/role/manifests/cache/misc.pp
index 695dc90..3de3729 100644
--- a/modules/role/manifests/cache/misc.pp
+++ b/modules/role/manifests/cache/misc.pp
@@ -258,6 +258,7 @@
role::cache::instances { 'misc':
fe_mem_gb => ceiling(0.5 * $::memorysize_mb / 1024.0),
+ fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk_size:17',
runtime_params => [],
app_directors => $app_directors,
# FIXME - top-scope var without namespace, will break in puppet 2.8
diff --git a/modules/role/manifests/cache/text.pp
b/modules/role/manifests/cache/text.pp
index 861d14f..2898553 100644
--- a/modules/role/manifests/cache/text.pp
+++ b/modules/role/manifests/cache/text.pp
@@ -109,6 +109,7 @@
role::cache::instances { 'text':
fe_mem_gb => ceiling(0.25 * $::memorysize_mb / 1024.0),
+ fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk_size:16',
runtime_params => ['default_ttl=2592000'],
app_directors => $app_directors,
# FIXME - top-scope var without namespace, will break in puppet 2.8
diff --git a/modules/role/manifests/cache/upload.pp
b/modules/role/manifests/cache/upload.pp
index 962d9bb..0953f7b 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -90,6 +90,7 @@
role::cache::instances { 'upload':
fe_mem_gb => ceiling(0.25 * $::memorysize_mb / 1024.0),
+ fe_jemalloc_conf => 'lg_dirty_mult:8,lg_chunk_size:17',
runtime_params => ['default_ttl=2592000'],
app_directors => $app_directors,
app_be_opts => [],
diff --git a/modules/varnish/manifests/instance.pp
b/modules/varnish/manifests/instance.pp
index 0081ed2..2ad339e 100644
--- a/modules/varnish/manifests/instance.pp
+++ b/modules/varnish/manifests/instance.pp
@@ -20,6 +20,7 @@
$name='',
$vcl = '',
$storage='-s malloc,1G',
+ $jemalloc_conf=undef,
$runtime_parameters=[],
$directors={},
$extra_vcl = []
diff --git a/modules/varnish/templates/initscripts/varnish.systemd.erb
b/modules/varnish/templates/initscripts/varnish.systemd.erb
index 0efe077..8357465 100644
--- a/modules/varnish/templates/initscripts/varnish.systemd.erb
+++ b/modules/varnish/templates/initscripts/varnish.systemd.erb
@@ -11,6 +11,9 @@
<% if @vcl_config.fetch("enable_geoiplookup", false) -%>
Environment="CC_COMMAND=exec cc -fpic -shared -Wl,-x -L/usr/local/lib/ -o %%o
%%s -lGeoIP"
<% end -%>
+<% if @jemalloc_conf -%>
+Environment="MALLOC_CONF=<%= @jemalloc_conf %>"
+<% end -%>
ExecReload=/usr/share/varnish/reload-vcl <%= @extraopts %> -q
ExecStart=/usr/sbin/varnishd \
-P %t/%p.pid \
--
To view, visit https://gerrit.wikimedia.org/r/291592
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0bdcbf6a0290b76131a6a43c3013d72b653100f
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Ema <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits