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

Rename the 'sess_workspace' param to 'workspace_client'.

I'm not quite there yet, but in the end we will have two workspaces:
req->ws for req.* and resp.* and busyobj->ws for bereq.* and beresp.*

Various argument changes as consequence of the sess->req moves.
parent ac2e067b
...@@ -761,7 +761,7 @@ int FetchError(struct worker *w, const char *error); ...@@ -761,7 +761,7 @@ int FetchError(struct worker *w, const char *error);
int FetchError2(struct worker *w, const char *error, const char *more); int FetchError2(struct worker *w, const char *error, const char *more);
int FetchHdr(struct sess *sp, int need_host_hdr); int FetchHdr(struct sess *sp, int need_host_hdr);
int FetchBody(struct worker *w, struct object *obj); int FetchBody(struct worker *w, struct object *obj);
int FetchReqBody(struct sess *sp); int FetchReqBody(const struct sess *sp);
void Fetch_Init(void); void Fetch_Init(void);
/* cache_gzip.c */ /* cache_gzip.c */
...@@ -825,7 +825,7 @@ double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field); ...@@ -825,7 +825,7 @@ double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field);
uint16_t http_GetStatus(const struct http *hp); uint16_t http_GetStatus(const struct http *hp);
const char *http_GetReq(const struct http *hp); const char *http_GetReq(const struct http *hp);
int http_HdrIs(const struct http *hp, const char *hdr, const char *val); int http_HdrIs(const struct http *hp, const char *hdr, const char *val);
uint16_t http_DissectRequest(struct sess *sp); uint16_t http_DissectRequest(const struct sess *sp);
uint16_t http_DissectResponse(struct worker *w, const struct http_conn *htc, uint16_t http_DissectResponse(struct worker *w, const struct http_conn *htc,
struct http *sp); struct http *sp);
const char *http_DoConnection(const struct http *hp); const char *http_DoConnection(const struct http *hp);
...@@ -910,13 +910,13 @@ void WRW_Sendfile(struct worker *w, int fd, off_t off, unsigned len); ...@@ -910,13 +910,13 @@ void WRW_Sendfile(struct worker *w, int fd, off_t off, unsigned len);
#endif /* SENDFILE_WORKS */ #endif /* SENDFILE_WORKS */
/* cache_session.c [SES] */ /* cache_session.c [SES] */
struct sess *SES_New(struct worker *wrk, struct sesspool *pp); struct sess *SES_New(struct sesspool *pp);
struct sess *SES_Alloc(void); struct sess *SES_Alloc(void);
void SES_Close(struct sess *sp, const char *reason); void SES_Close(struct sess *sp, const char *reason);
void SES_Delete(struct sess *sp, const char *reason, double now); void SES_Delete(struct sess *sp, const char *reason, double now);
void SES_Charge(struct sess *sp); void SES_Charge(struct sess *sp);
struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no); struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no);
void SES_DeletePool(struct sesspool *sp, struct worker *wrk); void SES_DeletePool(struct sesspool *sp);
int SES_Schedule(struct sess *sp); int SES_Schedule(struct sess *sp);
void SES_Handle(struct sess *sp, double now); void SES_Handle(struct sess *sp, double now);
void SES_GetReq(struct sess *sp); void SES_GetReq(struct sess *sp);
...@@ -966,7 +966,7 @@ void RES_StreamPoll(struct worker *); ...@@ -966,7 +966,7 @@ void RES_StreamPoll(struct worker *);
/* cache_vary.c */ /* cache_vary.c */
struct vsb *VRY_Create(const struct sess *sp, const struct http *hp); struct vsb *VRY_Create(const struct sess *sp, const struct http *hp);
int VRY_Match(struct sess *sp, const uint8_t *vary); int VRY_Match(const struct sess *sp, const uint8_t *vary);
void VRY_Validate(const uint8_t *vary); void VRY_Validate(const uint8_t *vary);
/* cache_vcl.c */ /* cache_vcl.c */
......
...@@ -618,9 +618,11 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp, ...@@ -618,9 +618,11 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
arg1 = NULL; arg1 = NULL;
switch (bt.arg1) { switch (bt.arg1) {
case BAN_ARG_URL: case BAN_ARG_URL:
AN(reqhttp);
arg1 = reqhttp->hd[HTTP_HDR_URL].b; arg1 = reqhttp->hd[HTTP_HDR_URL].b;
break; break;
case BAN_ARG_REQHTTP: case BAN_ARG_REQHTTP:
AN(reqhttp);
(void)http_GetHdr(reqhttp, bt.arg1_spec, &arg1); (void)http_GetHdr(reqhttp, bt.arg1_spec, &arg1);
break; break;
case BAN_ARG_OBJHTTP: case BAN_ARG_OBJHTTP:
......
...@@ -329,7 +329,7 @@ fetch_eof(struct worker *wrk, struct http_conn *htc) ...@@ -329,7 +329,7 @@ fetch_eof(struct worker *wrk, struct http_conn *htc)
*/ */
int int
FetchReqBody(struct sess *sp) FetchReqBody(const struct sess *sp)
{ {
unsigned long content_length; unsigned long content_length;
char buf[8192]; char buf[8192];
......
...@@ -651,7 +651,7 @@ http_ProtoVer(struct http *hp) ...@@ -651,7 +651,7 @@ http_ProtoVer(struct http *hp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
uint16_t uint16_t
http_DissectRequest(struct sess *sp) http_DissectRequest(const struct sess *sp)
{ {
struct http_conn *htc; struct http_conn *htc;
struct http *hp; struct http *hp;
......
...@@ -238,7 +238,7 @@ Pool_Work_Thread(void *priv, struct worker *w) ...@@ -238,7 +238,7 @@ Pool_Work_Thread(void *priv, struct worker *w)
/* Turn accepted socket into a session */ /* Turn accepted socket into a session */
AZ(w->sp); AZ(w->sp);
AN(w->ws->r); AN(w->ws->r);
w->sp = SES_New(w, pp->sesspool); w->sp = SES_New(pp->sesspool);
if (w->sp == NULL) { if (w->sp == NULL) {
VCA_FailSess(w); VCA_FailSess(w);
w->do_what = pool_do_nothing; w->do_what = pool_do_nothing;
...@@ -538,7 +538,7 @@ pool_poolherder(void *priv) ...@@ -538,7 +538,7 @@ pool_poolherder(void *priv)
} }
/* XXX: remove pools */ /* XXX: remove pools */
if (0) if (0)
SES_DeletePool(NULL, NULL); SES_DeletePool(NULL);
(void)sleep(1); (void)sleep(1);
u = 0; u = 0;
VTAILQ_FOREACH(pp, &pools, list) VTAILQ_FOREACH(pp, &pools, list)
......
...@@ -98,11 +98,10 @@ ses_setup(struct sess *sp) ...@@ -98,11 +98,10 @@ ses_setup(struct sess *sp)
*/ */
struct sess * struct sess *
SES_New(struct worker *wrk, struct sesspool *pp) SES_New(struct sesspool *pp)
{ {
struct sess *sp; struct sess *sp;
(void)wrk; // XXX
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC); CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
sp = MPL_Get(pp->mpl_sess, NULL); sp = MPL_Get(pp->mpl_sess, NULL);
sp->magic = SESS_MAGIC; sp->magic = SESS_MAGIC;
...@@ -280,7 +279,7 @@ SES_GetReq(struct sess *sp) ...@@ -280,7 +279,7 @@ SES_GetReq(struct sess *sp)
sp->req->http0 = HTTP_create(p, nhttp); sp->req->http0 = HTTP_create(p, nhttp);
p += hl; p += hl;
sz -= hl; sz -= hl;
WS_Init(sp->req->ws, "req", p, sz); WS_Init(sp->req->ws, "req", p, sz);
} }
...@@ -314,17 +313,16 @@ SES_NewPool(struct pool *wp, unsigned pool_no) ...@@ -314,17 +313,16 @@ SES_NewPool(struct pool *wp, unsigned pool_no)
pp->pool = wp; pp->pool = wp;
bprintf(nb, "req%u", pool_no); bprintf(nb, "req%u", pool_no);
pp->mpl_req = MPL_New(nb, &cache_param->req_pool, pp->mpl_req = MPL_New(nb, &cache_param->req_pool,
&cache_param->sess_workspace); &cache_param->workspace_client);
pp->mpl_sess = MPL_New(nb, &cache_param->sess_pool, &ses_size); pp->mpl_sess = MPL_New(nb, &cache_param->sess_pool, &ses_size);
return (pp); return (pp);
} }
void void
SES_DeletePool(struct sesspool *pp, struct worker *wrk) SES_DeletePool(struct sesspool *pp)
{ {
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC); CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
MPL_Destroy(&pp->mpl_sess); MPL_Destroy(&pp->mpl_sess);
MPL_Destroy(&pp->mpl_req); MPL_Destroy(&pp->mpl_req);
FREE_OBJ(pp); FREE_OBJ(pp);
......
...@@ -174,7 +174,7 @@ vry_cmp(const uint8_t * const *v1, uint8_t * const *v2) ...@@ -174,7 +174,7 @@ vry_cmp(const uint8_t * const *v1, uint8_t * const *v2)
} }
int int
VRY_Match(struct sess *sp, const uint8_t *vary) VRY_Match(const struct sess *sp, const uint8_t *vary)
{ {
uint8_t *vsp = sp->req->vary_b; uint8_t *vsp = sp->req->vary_b;
char *h, *e; char *h, *e;
......
...@@ -75,7 +75,7 @@ struct params { ...@@ -75,7 +75,7 @@ struct params {
unsigned queue_max; unsigned queue_max;
/* Memory allocation hints */ /* Memory allocation hints */
unsigned sess_workspace; unsigned workspace_client;
unsigned shm_workspace; unsigned shm_workspace;
unsigned http_req_size; unsigned http_req_size;
unsigned http_req_hdr_len; unsigned http_req_hdr_len;
......
...@@ -687,12 +687,9 @@ static const struct parspec input_parspec[] = { ...@@ -687,12 +687,9 @@ static const struct parspec input_parspec[] = {
"flush of the cache use \"ban.url .\"", "flush of the cache use \"ban.url .\"",
0, 0,
"120", "seconds" }, "120", "seconds" },
{ "sess_workspace", { "workspace_client",
tweak_bytes_u, &mgt_param.sess_workspace, 3072, UINT_MAX, tweak_bytes_u, &mgt_param.workspace_client, 3072, UINT_MAX,
"Bytes of HTTP protocol workspace allocated for sessions. " "Bytes of HTTP protocol workspace for clients HTTP req/resp.",
"This space must be big enough for the entire HTTP protocol "
"header and any edits done to it in the VCL code.\n"
"Minimum is 1024 bytes.",
DELAYED_EFFECT, DELAYED_EFFECT,
"64k", "bytes" }, "64k", "bytes" },
{ "http_req_hdr_len", { "http_req_hdr_len",
......
...@@ -14,7 +14,7 @@ server s1 { ...@@ -14,7 +14,7 @@ server s1 {
} }
} -start } -start
varnish v1 -arg "-p sess_workspace=131072 -p thread_pool_stack=262144" -vcl+backend { varnish v1 -arg "-p thread_pool_stack=262144" -vcl+backend {
sub vcl_recv { sub vcl_recv {
set req.esi = true; set req.esi = true;
} }
......
...@@ -17,7 +17,7 @@ server s1 { ...@@ -17,7 +17,7 @@ server s1 {
} -start } -start
varnish v1 -arg "-p sess_workspace=3072" -vcl+backend { varnish v1 -arg "-p workspace_client=3072" -vcl+backend {
sub vcl_recv { sub vcl_recv {
set req.http.foo = set req.http.foo =
......
...@@ -144,36 +144,6 @@ VSC_F(fetch_1xx, uint64_t, 1, 'a', "Fetch no body (1xx)", "") ...@@ -144,36 +144,6 @@ VSC_F(fetch_1xx, uint64_t, 1, 'a', "Fetch no body (1xx)", "")
VSC_F(fetch_204, uint64_t, 1, 'a', "Fetch no body (204)", "") VSC_F(fetch_204, uint64_t, 1, 'a', "Fetch no body (204)", "")
VSC_F(fetch_304, uint64_t, 1, 'a', "Fetch no body (304)", "") VSC_F(fetch_304, uint64_t, 1, 'a', "Fetch no body (304)", "")
/*---------------------------------------------------------------------
* Session Memory
* see: cache_session.c
*/
VSC_F(sessmem_size, uint64_t, 1, 'g',
"Session mem size",
"Bytes of memory allocated for last allocated session."
)
VSC_F(sessmem_alloc, uint64_t, 1, 'c',
"Session mem allocated",
"Count of all allocations of session memory."
)
VSC_F(sessmem_free, uint64_t, 1, 'c',
"Session mem freed",
"Count of all frees of session memory."
)
VSC_F(sessmem_fail, uint64_t, 1, 'c',
"Session mem alloc failed",
"Count of session memory allocation failures."
)
VSC_F(sessmem_limit, uint64_t, 1, 'c',
"Session mem alloc limited",
"Count of session memory allocations blocked by limit (max_sess)."
)
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
* Pools, threads, and sessions * Pools, threads, and sessions
* see: cache_pool.c * see: cache_pool.c
...@@ -252,8 +222,6 @@ VSC_F(busyobj_free, uint64_t, 1, 'c', ...@@ -252,8 +222,6 @@ VSC_F(busyobj_free, uint64_t, 1, 'c',
/*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/
VSC_F(n_sess_mem, uint64_t, 0, 'i', "N struct sess_mem", "")
VSC_F(n_sess, uint64_t, 0, 'i', "N struct sess", "")
VSC_F(n_object, uint64_t, 1, 'i', "N struct object", "") VSC_F(n_object, uint64_t, 1, 'i', "N struct object", "")
VSC_F(n_vampireobject, uint64_t, 1, 'i', "N unresurrected objects", "") VSC_F(n_vampireobject, uint64_t, 1, 'i', "N unresurrected objects", "")
VSC_F(n_objectcore, uint64_t, 1, 'i', "N struct objectcore", "") VSC_F(n_objectcore, uint64_t, 1, 'i', "N struct objectcore", "")
......
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