[master] 85f5706 Add a parameter to limit how big chunks we attempt to allocate from storage. Asking for more than 256M at a time will not actually improve performance and is quite likely to hurt it.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Apr 18 12:39:33 CEST 2011
commit 85f57069f70fc56d6e2c351539ef322be96dafc0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Apr 18 10:25:42 2011 +0000
Add a parameter to limit how big chunks we attempt to allocate
from storage. Asking for more than 256M at a time will not
actually improve performance and is quite likely to hurt it.
diff --git a/bin/varnishd/heritage.h b/bin/varnishd/heritage.h
index c1a251f..b45e5ee 100644
--- a/bin/varnishd/heritage.h
+++ b/bin/varnishd/heritage.h
@@ -118,6 +118,7 @@ struct params {
/* Fetcher hints */
unsigned fetch_chunksize;
+ unsigned fetch_maxchunksize;
#ifdef SENDFILE_WORKS
/* Sendfile object minimum size */
diff --git a/bin/varnishd/mgt_param.c b/bin/varnishd/mgt_param.c
index d0e9c20..7c5a328 100644
--- a/bin/varnishd/mgt_param.c
+++ b/bin/varnishd/mgt_param.c
@@ -629,6 +629,13 @@ static const struct parspec input_parspec[] = {
"above 128kb a dubious idea.",
EXPERIMENTAL,
"128", "kilobytes" },
+ { "fetch_maxchunksize",
+ tweak_uint, &master.fetch_maxchunksize, 64, UINT_MAX / 1024.,
+ "The maximum chunksize we attempt to allocate from storage. "
+ "Making this too large may cause delays and storage "
+ "fragmentation.\n",
+ EXPERIMENTAL,
+ "262144", "kilobytes" },
#ifdef SENDFILE_WORKS
{ "sendfile_threshold",
tweak_uint, &master.sendfile_threshold, 0, UINT_MAX,
diff --git a/bin/varnishd/stevedore.c b/bin/varnishd/stevedore.c
index 5344bac..8ee4040 100644
--- a/bin/varnishd/stevedore.c
+++ b/bin/varnishd/stevedore.c
@@ -171,6 +171,9 @@ stv_alloc(const struct sess *sp, size_t size)
}
CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
+ if (size > (size_t)(params->fetch_maxchunksize) << 10)
+ size = (size_t)(params->fetch_maxchunksize) << 10;
+
for (;;) {
/* try to allocate from it */
AN(stv->alloc);
More information about the varnish-commit
mailing list