[PATCH 04/25] Add a (configurable through parameter stream_maxchunksize) chunk size limit when streaming.
Martin Blix Grydeland
martin at varnish-software.com
Sun Jan 22 18:53:10 CET 2012
---
bin/varnishd/cache/cache_fetch.c | 2 ++
bin/varnishd/common/params.h | 1 +
bin/varnishd/mgt/mgt_param.c | 9 +++++++++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 06d23e6..8cf9350 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -189,6 +189,8 @@ FetchStorage(struct worker *wrk, ssize_t sz)
l = sz;
if (l == 0)
l = cache_param->fetch_chunksize;
+ if (wrk->busyobj->do_stream && l > cache_param->stream_maxchunksize)
+ l = cache_param->stream_maxchunksize;
st = STV_alloc(wrk, l);
if (st == NULL) {
(void)FetchError(wrk, "Could not get storage");
diff --git a/bin/varnishd/common/params.h b/bin/varnishd/common/params.h
index 6c1899a..f0445ae 100644
--- a/bin/varnishd/common/params.h
+++ b/bin/varnishd/common/params.h
@@ -98,6 +98,7 @@ struct params {
/* Fetcher hints */
ssize_t fetch_chunksize;
ssize_t fetch_maxchunksize;
+ ssize_t stream_maxchunksize;
unsigned nuke_limit;
#ifdef SENDFILE_WORKS
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index c984aae..227ea3a 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -837,6 +837,15 @@ static const struct parspec input_parspec[] = {
"fragmentation.\n",
EXPERIMENTAL,
"256m", "bytes" },
+ { "stream_maxchunksize",
+ tweak_bytes_u,
+ &mgt_param.stream_maxchunksize, 4 * 1024, UINT_MAX,
+ "The maximum chunksize we attempt to allocate from storage "
+ "when streaming. This also defines the intervals at which "
+ "the streaming clients receive notifications about new "
+ "data available.\n",
+ EXPERIMENTAL,
+ "256k", "bytes" },
#ifdef SENDFILE_WORKS
{ "sendfile_threshold",
tweak_bytes, &mgt_param.sendfile_threshold, 0, HUGE_VAL,
--
1.7.4.1
More information about the varnish-dev
mailing list