r949 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Fri Sep 8 08:47:55 CEST 2006
Author: phk
Date: 2006-09-08 08:47:55 +0200 (Fri, 08 Sep 2006)
New Revision: 949
Modified:
trunk/varnish-cache/bin/varnishd/cache_fetch.c
trunk/varnish-cache/bin/varnishd/heritage.h
trunk/varnish-cache/bin/varnishd/mgt_param.c
Log:
Make the fetchers chunksize a parameter, but keep the default at 128k
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-09-08 05:58:33 UTC (rev 948)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-09-08 06:47:55 UTC (rev 949)
@@ -16,17 +16,8 @@
#include "shmlog.h"
#include "cache.h"
+#include "heritage.h"
-/*
- * Chunked encoding is a hack. We prefer to have a single chunk or a
- * few large chunks, and not a terribly long list of small ones.
- * If our stevedore can trim, we alloc big chunks and trim the last one
- * at the end when we know the result.
- *
- * Good testcase: http://www.washingtonpost.com/
- */
-#define CHUNK_PREALLOC (128 * 1024)
-
/*--------------------------------------------------------------------*/
static int
@@ -112,9 +103,9 @@
/* Get some storage if we don't have any */
if (st == NULL || st->len == st->space) {
v = u;
- if (u < CHUNK_PREALLOC &&
+ if (u < params->fetch_chunksize &&
stevedore->trim != NULL)
- v = CHUNK_PREALLOC;
+ v = params->fetch_chunksize;
st = stevedore->alloc(stevedore, v);
XXXAN(st->stevedore);
TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
@@ -189,7 +180,7 @@
st = NULL;
while (1) {
if (v == 0) {
- st = stevedore->alloc(stevedore, CHUNK_PREALLOC);
+ st = stevedore->alloc(stevedore, params->fetch_chunksize);
XXXAN(st->stevedore);
TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
p = st->ptr + st->len;
Modified: trunk/varnish-cache/bin/varnishd/heritage.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/heritage.h 2006-09-08 05:58:33 UTC (rev 948)
+++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-09-08 06:47:55 UTC (rev 949)
@@ -47,6 +47,9 @@
/* Management hints */
unsigned auto_restart;
+
+ /* Fetcher hints */
+ unsigned fetch_chunksize;
};
extern struct params *params;
Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-09-08 05:58:33 UTC (rev 948)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-09-08 06:47:55 UTC (rev 949)
@@ -190,6 +190,23 @@
/*--------------------------------------------------------------------*/
+static void
+tweak_fetch_chunksize(struct cli *cli, struct parspec *par, const char *arg)
+{
+ unsigned u;
+
+ (void)par;
+ if (arg != NULL) {
+ u = strtoul(arg, NULL, 0);
+ params->fetch_chunksize = u;
+ }
+ if (cli == NULL)
+ return;
+ cli_out(cli, "%u [kb]\n", params->fetch_chunksize);
+}
+
+/*--------------------------------------------------------------------*/
+
/*
* Make sure to end all lines with either a space or newline of the
* formatting will go haywire.
@@ -257,6 +274,9 @@
"Restart child process automatically if it dies. "
"1 = yes, 0 = no.\n"
"Default is 1. ", "1" },
+ { "fetch_chunksize", tweak_fetch_chunksize,
+ "The default chunksize used by fetcher.\n"
+ "Default is 128 kilobytes. ", "128" },
{ NULL, NULL, NULL }
};
More information about the varnish-commit
mailing list