Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
c34f10e1
Commit
c34f10e1
authored
Jul 18, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the temporary accounting structure from wrk to req and
eliminate two SES_Charge() calls that have nothing to charge.
parent
3cc4a726
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
30 deletions
+39
-30
cache.h
bin/varnishd/cache/cache.h
+4
-4
cache_center.c
bin/varnishd/cache/cache_center.c
+7
-7
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+3
-3
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+11
-4
cache_pipe.c
bin/varnishd/cache/cache_pipe.c
+2
-2
cache_response.c
bin/varnishd/cache/cache_response.c
+5
-5
cache_session.c
bin/varnishd/cache/cache_session.c
+5
-2
acct_fields.h
include/tbl/acct_fields.h
+2
-3
No files found.
bin/varnishd/cache/cache.h
View file @
c34f10e1
...
...
@@ -344,8 +344,6 @@ struct worker {
struct
vxid_pool
vxid_pool
;
/* Temporary accounting */
struct
acct
acct_tmp
;
};
/* LRU ---------------------------------------------------------------*/
...
...
@@ -661,6 +659,8 @@ struct req {
/* Transaction VSL buffer */
struct
vsl_log
vsl
[
1
];
/* Temporary accounting */
struct
acct
acct_req
;
};
/*--------------------------------------------------------------------
...
...
@@ -821,9 +821,9 @@ int VGZ_Destroy(struct vgz **);
void
VGZ_UpdateObj
(
const
struct
vgz
*
,
struct
object
*
);
int
VGZ_WrwInit
(
struct
vgz
*
vg
);
int
VGZ_WrwGunzip
(
struct
worker
*
w
,
struct
vgz
*
,
const
void
*
ibuf
,
int
VGZ_WrwGunzip
(
struct
req
*
,
struct
vgz
*
,
const
void
*
ibuf
,
ssize_t
ibufl
);
void
VGZ_WrwFlush
(
struct
worker
*
wrk
,
struct
vgz
*
vg
);
void
VGZ_WrwFlush
(
struct
req
*
,
struct
vgz
*
vg
);
/* Return values */
#define VGZ_ERROR -1
...
...
bin/varnishd/cache/cache_center.c
View file @
c34f10e1
...
...
@@ -161,7 +161,6 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
if
(
when
<
now
||
tmo
==
0
)
{
sp
->
t_rx
=
NAN
;
wrk
->
stats
.
sess_herd
++
;
SES_Charge
(
wrk
,
req
);
SES_ReleaseReq
(
req
);
WAIT_Enter
(
sp
);
return
(
1
);
...
...
@@ -176,7 +175,6 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
}
}
}
SES_Charge
(
wrk
,
req
);
AZ
(
req
->
vcl
);
SES_ReleaseReq
(
req
);
SES_Delete
(
sp
,
why
,
now
);
...
...
@@ -659,7 +657,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
need_host_hdr
=
!
http_GetHdr
(
bo
->
bereq
,
H_Host
,
NULL
);
wrk
->
acct_tmp
.
fetch
++
;
req
->
acct_req
.
fetch
++
;
i
=
FetchHdr
(
req
,
need_host_hdr
,
req
->
objcore
->
objhead
==
NULL
);
/*
...
...
@@ -1264,7 +1262,7 @@ cnt_pass(struct worker *wrk, struct req *req)
return
(
0
);
}
assert
(
req
->
handling
==
VCL_RET_PASS
);
wrk
->
acct_tmp
.
pass
++
;
req
->
acct_req
.
pass
++
;
req
->
req_step
=
R_STP_FETCH
;
req
->
objcore
=
HSH_NewObjCore
(
wrk
);
...
...
@@ -1307,7 +1305,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL
(
req
->
vcl
,
VCL_CONF_MAGIC
);
AZ
(
req
->
busyobj
);
wrk
->
acct_tmp
.
pipe
++
;
req
->
acct_req
.
pipe
++
;
req
->
busyobj
=
VBO_GetBusyObj
(
wrk
);
bo
=
req
->
busyobj
;
bo
->
vsl
->
wid
=
req
->
sp
->
vsl_id
;
...
...
@@ -1486,7 +1484,7 @@ cnt_start(struct worker *wrk, struct req *req)
/* Update stats of various sorts */
wrk
->
stats
.
client_req
++
;
wrk
->
acct_tmp
.
req
++
;
req
->
acct_req
.
req
++
;
/* Assign XID and log */
req
->
xid
=
++
xids
;
/* XXX not locked */
...
...
@@ -1600,8 +1598,10 @@ CNT_Request(struct worker *wrk, struct req *req)
WS_Assert
(
wrk
->
aws
);
CHECK_OBJ_ORNULL
(
wrk
->
nobjhead
,
OBJHEAD_MAGIC
);
}
if
(
done
==
1
)
if
(
done
==
1
)
{
/* done == 2 was charged by cache_hash.c */
SES_Charge
(
wrk
,
req
);
}
req
->
wrk
=
NULL
;
...
...
bin/varnishd/cache/cache_esi_deliver.c
View file @
c34f10e1
...
...
@@ -321,7 +321,7 @@ ESI_Deliver(struct req *req)
* response
*/
AN
(
vgz
);
i
=
VGZ_WrwGunzip
(
req
->
wrk
,
vgz
,
i
=
VGZ_WrwGunzip
(
req
,
vgz
,
st
->
ptr
+
off
,
l2
);
if
(
WRW_Error
(
req
->
wrk
))
{
SES_Close
(
req
->
sp
,
...
...
@@ -374,7 +374,7 @@ ESI_Deliver(struct req *req)
r
=
(
void
*
)
strchr
((
const
char
*
)
q
,
'\0'
);
AN
(
r
);
if
(
vgz
!=
NULL
)
VGZ_WrwFlush
(
req
->
wrk
,
vgz
);
VGZ_WrwFlush
(
req
,
vgz
);
if
(
WRW_Flush
(
req
->
wrk
))
{
SES_Close
(
req
->
sp
,
SC_REM_CLOSE
);
p
=
e
;
...
...
@@ -391,7 +391,7 @@ ESI_Deliver(struct req *req)
}
}
if
(
vgz
!=
NULL
)
{
VGZ_WrwFlush
(
req
->
wrk
,
vgz
);
VGZ_WrwFlush
(
req
,
vgz
);
(
void
)
VGZ_Destroy
(
&
vgz
);
}
if
(
req
->
gzip_resp
&&
req
->
esi_level
==
0
)
{
...
...
bin/varnishd/cache/cache_gzip.c
View file @
c34f10e1
...
...
@@ -315,13 +315,16 @@ VGZ_WrwInit(struct vgz *vg)
*/
int
VGZ_WrwGunzip
(
struct
worker
*
wrk
,
struct
vgz
*
vg
,
const
void
*
ibuf
,
VGZ_WrwGunzip
(
struct
req
*
req
,
struct
vgz
*
vg
,
const
void
*
ibuf
,
ssize_t
ibufl
)
{
int
i
;
size_t
dl
;
const
void
*
dp
;
struct
worker
*
wrk
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
wrk
=
req
->
wrk
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
AN
(
vg
->
m_buf
);
...
...
@@ -340,7 +343,7 @@ VGZ_WrwGunzip(struct worker *wrk, struct vgz *vg, const void *ibuf,
return
(
-
1
);
}
if
(
vg
->
m_len
==
vg
->
m_sz
||
i
==
VGZ_STUCK
)
{
wrk
->
acct_tmp
.
bodybytes
+=
vg
->
m_len
;
req
->
acct_req
.
bodybytes
+=
vg
->
m_len
;
(
void
)
WRW_Write
(
wrk
,
vg
->
m_buf
,
vg
->
m_len
);
(
void
)
WRW_Flush
(
wrk
);
vg
->
m_len
=
0
;
...
...
@@ -355,15 +358,19 @@ VGZ_WrwGunzip(struct worker *wrk, struct vgz *vg, const void *ibuf,
/*--------------------------------------------------------------------*/
void
VGZ_WrwFlush
(
struct
worker
*
wrk
,
struct
vgz
*
vg
)
VGZ_WrwFlush
(
struct
req
*
req
,
struct
vgz
*
vg
)
{
struct
worker
*
wrk
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
wrk
=
req
->
wrk
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
if
(
vg
->
m_len
==
0
)
return
;
wrk
->
acct_tmp
.
bodybytes
+=
vg
->
m_len
;
req
->
acct_req
.
bodybytes
+=
vg
->
m_len
;
(
void
)
WRW_Write
(
wrk
,
vg
->
m_buf
,
vg
->
m_len
);
(
void
)
WRW_Flush
(
wrk
);
vg
->
m_len
=
0
;
...
...
bin/varnishd/cache/cache_pipe.c
View file @
c34f10e1
...
...
@@ -82,10 +82,10 @@ PipeRequest(struct req *req)
(
void
)
VTCP_blocking
(
vc
->
fd
);
WRW_Reserve
(
wrk
,
&
vc
->
fd
,
bo
->
vsl
,
req
->
t_req
);
wrk
->
acct_tmp
.
hdrbytes
+=
http_Write
(
wrk
,
bo
->
bereq
,
0
);
req
->
acct_req
.
hdrbytes
+=
http_Write
(
wrk
,
bo
->
bereq
,
0
);
if
(
req
->
htc
->
pipeline
.
b
!=
NULL
)
wrk
->
acct_tmp
.
bodybytes
+=
req
->
acct_req
.
bodybytes
+=
WRW_Write
(
wrk
,
req
->
htc
->
pipeline
.
b
,
Tlen
(
req
->
htc
->
pipeline
));
...
...
bin/varnishd/cache/cache_response.c
View file @
c34f10e1
...
...
@@ -171,11 +171,11 @@ res_WriteGunzipObj(struct req *req)
CHECK_OBJ_NOTNULL
(
st
,
STORAGE_MAGIC
);
u
+=
st
->
len
;
i
=
VGZ_WrwGunzip
(
req
->
wrk
,
vg
,
st
->
ptr
,
st
->
len
);
i
=
VGZ_WrwGunzip
(
req
,
vg
,
st
->
ptr
,
st
->
len
);
/* XXX: error check */
(
void
)
i
;
}
VGZ_WrwFlush
(
req
->
wrk
,
vg
);
VGZ_WrwFlush
(
req
,
vg
);
(
void
)
VGZ_Destroy
(
&
vg
);
assert
(
u
==
req
->
obj
->
len
);
}
...
...
@@ -183,7 +183,7 @@ res_WriteGunzipObj(struct req *req)
/*--------------------------------------------------------------------*/
static
void
res_WriteDirObj
(
const
struct
req
*
req
,
ssize_t
low
,
ssize_t
high
)
res_WriteDirObj
(
struct
req
*
req
,
ssize_t
low
,
ssize_t
high
)
{
ssize_t
u
=
0
;
size_t
ptr
,
off
,
len
;
...
...
@@ -215,7 +215,7 @@ res_WriteDirObj(const struct req *req, ssize_t low, ssize_t high)
ptr
+=
len
;
req
->
wrk
->
acct_tmp
.
bodybytes
+=
len
;
req
->
acct_req
.
bodybytes
+=
len
;
(
void
)
WRW_Write
(
req
->
wrk
,
st
->
ptr
+
off
,
len
);
}
assert
(
u
==
req
->
obj
->
len
);
...
...
@@ -254,7 +254,7 @@ RES_WriteObj(struct req *req)
* Send HTTP protocol header, unless interior ESI object
*/
if
(
!
(
req
->
res_mode
&
RES_ESI_CHILD
))
req
->
wrk
->
acct_tmp
.
hdrbytes
+=
req
->
acct_req
.
hdrbytes
+=
http_Write
(
req
->
wrk
,
req
->
resp
,
1
);
if
(
!
req
->
wantbody
)
...
...
bin/varnishd/cache/cache_session.c
View file @
c34f10e1
...
...
@@ -79,7 +79,7 @@ SES_Charge(struct worker *wrk, struct req *req)
sp
=
req
->
sp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
a
=
&
wrk
->
acct_tmp
;
a
=
&
req
->
acct_req
;
req
->
req_bodybytes
+=
a
->
bodybytes
;
#define ACCT(foo) \
...
...
@@ -229,7 +229,7 @@ SES_pool_accept_task(struct worker *wrk, void *arg)
VCA_FailSess
(
wrk
);
return
;
}
wrk
->
acct_tmp
.
sess
++
;
wrk
->
stats
.
s_
sess
++
;
sp
->
t_open
=
VTIM_real
();
sp
->
t_rx
=
sp
->
t_open
;
...
...
@@ -431,6 +431,9 @@ SES_ReleaseReq(struct req *req)
struct
sesspool
*
pp
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
#define ACCT(foo) AZ(req->acct_req.foo);
#include "tbl/acct_fields.h"
#undef ACCT
sp
=
req
->
sp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
pp
=
sp
->
sesspool
;
...
...
include/tbl/acct_fields.h
View file @
c34f10e1
...
...
@@ -26,12 +26,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* These are the stats we keep track of per session.
They will be summed,
*
via the sp->wrk->stats into the s_<name> fields in the SHM file.
* These are the stats we keep track of per session.
*
SES_Charge() sums them into wrk->stats
* NB: Remember to mark those in vsc_fields.h to be included in struct dstat.
*/
ACCT
(
sess
)
ACCT
(
req
)
ACCT
(
pipe
)
ACCT
(
pass
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment