Commit d98dee20 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give busyobj its own VSL staging buffer too.

parent b7620169
......@@ -451,8 +451,6 @@ oc_getlru(const struct objcore *oc)
*
* One of these aspects will be how much has been fetched, which
* streaming delivery will make use of.
*
* XXX: many fields from worker needs to move here.
*/
struct busyobj {
......@@ -493,6 +491,8 @@ struct busyobj {
double connect_timeout;
double first_byte_timeout;
double between_bytes_timeout;
struct vsl_log vsl[1];
};
/* Object structure --------------------------------------------------*/
......
......@@ -98,14 +98,11 @@ VBO_GetBusyObj(struct worker *wrk)
{
struct vbo *vbo = NULL;
uint16_t nhttp;
unsigned httpsz;
unsigned sz;
char *p;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
nhttp = (uint16_t)cache_param->http_max_hdr;
httpsz = HTTP_estimate(nhttp);
if (wrk->nvbo != NULL) {
vbo = wrk->nvbo;
wrk->nvbo = NULL;
......@@ -123,15 +120,28 @@ VBO_GetBusyObj(struct worker *wrk)
vbo->bo.vbo = vbo;
p = (void*)(vbo + 1);
p = (void*)PRNDUP(p);
assert(p < vbo->end);
nhttp = (uint16_t)cache_param->http_max_hdr;
sz = HTTP_estimate(nhttp);
vbo->bo.bereq = HTTP_create(p, nhttp);
p += httpsz;
p += sz;
p = (void*)PRNDUP(p);
assert(p < vbo->end);
vbo->bo.beresp = HTTP_create(p, nhttp);
p += httpsz;
if (p >= vbo->end) {
fprintf(stderr, "workspace_backend is at least %jd to small\n",
(p - vbo->end));
assert (p < vbo->end);
}
p += sz;
p = (void*)PRNDUP(p);
assert(p < vbo->end);
sz = cache_param->vsl_buffer;
VSL_Setup(vbo->bo.vsl, p, sz);
p += sz;
p = (void*)PRNDUP(p);
assert(p < vbo->end);
WS_Init(vbo->bo.ws, "bo", p, vbo->end - p);
return (&vbo->bo);
......@@ -170,13 +180,15 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
r = --vbo->refcount;
Lck_Unlock(&vbo->mtx);
if (r == 0) {
/* XXX: Sanity checks & cleanup */
memset(&vbo->bo, 0, sizeof vbo->bo);
if (r)
return;
if (cache_param->bo_cache && wrk->nvbo == NULL)
wrk->nvbo = vbo;
else
VBO_Free(&vbo);
}
WSL_Flush(vbo->bo.vsl, 0);
/* XXX: Sanity checks & cleanup */
memset(&vbo->bo, 0, sizeof vbo->bo);
if (cache_param->bo_cache && wrk->nvbo == NULL)
wrk->nvbo = vbo;
else
VBO_Free(&vbo);
}
......@@ -480,6 +480,7 @@ cnt_error(struct sess *sp, struct worker *wrk, struct req *req)
AZ(wrk->busyobj);
wrk->busyobj = VBO_GetBusyObj(wrk);
wrk->busyobj->vsl->wid = sp->vsl_id;
req->obj = STV_NewObject(wrk, TRANSIENT_STORAGE,
cache_param->http_resp_size,
(uint16_t)cache_param->http_max_hdr);
......@@ -1222,7 +1223,6 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
AZ(req->obj);
wrk->busyobj = VBO_GetBusyObj(wrk);
http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
http_FilterReq(sp, HTTPH_R_FETCH);
http_ForceGet(wrk->busyobj->bereq);
......@@ -1297,6 +1297,7 @@ cnt_pass(struct sess *sp, struct worker *wrk, const struct req *req)
AZ(wrk->busyobj);
wrk->busyobj = VBO_GetBusyObj(wrk);
wrk->busyobj->vsl->wid = sp->vsl_id;
http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
http_FilterReq(sp, HTTPH_R_PASS);
......@@ -1351,6 +1352,7 @@ cnt_pipe(struct sess *sp, struct worker *wrk, const struct req *req)
wrk->acct_tmp.pipe++;
wrk->busyobj = VBO_GetBusyObj(wrk);
wrk->busyobj->vsl->wid = sp->vsl_id;
http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
http_FilterReq(sp, 0);
......
......@@ -416,6 +416,8 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
if (vc->recycled)
retry = 1;
sp->wrk->busyobj->vsl->wid = vc->vsl_id;
/*
* Now that we know our backend, we can set a default Host:
* header if one is necessary. This cannot be done in the VCL
......
......@@ -453,6 +453,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
AZ(wrk->busyobj);
wrk->busyobj = VBO_GetBusyObj(wrk);
wrk->busyobj->vsl->wid = sp->vsl_id;
VRY_Validate(sp->req->vary_b);
if (sp->req->vary_l != NULL)
......
......@@ -45,7 +45,7 @@ server s1 {
txresp -body "foo8"
} -start
varnish v1 -arg "-p workspace_backend=3072" -vcl+backend {
varnish v1 -arg "-p workspace_backend=7k" -vcl+backend {
sub vcl_fetch {
set beresp.do_esi = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment