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
79101ecc
Commit
79101ecc
authored
Sep 24, 2018
by
Poul-Henning Kamp
Committed by
Dridi Boukelmoune
Oct 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the wrk+pool summed stats into group 'wrk'.
This eliminates read-add-zero-write on counters outside this group.
parent
737d6c2d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
58 deletions
+108
-58
VSC_main.vsc
bin/varnishd/VSC_main.vsc
+60
-11
cache.h
bin/varnishd/cache/cache.h
+2
-1
cache_pool.c
bin/varnishd/cache/cache_pool.c
+4
-12
cache_pool.h
bin/varnishd/cache/cache_pool.h
+2
-2
cache_req.c
bin/varnishd/cache/cache_req.c
+1
-1
cache_varnishd.h
bin/varnishd/cache/cache_varnishd.h
+1
-1
cache_wrk.c
bin/varnishd/cache/cache_wrk.c
+4
-4
vsctool.py
lib/libvcc/vsctool.py
+34
-26
No files found.
bin/varnishd/VSC_main.vsc
View file @
79101ecc
...
...
@@ -5,10 +5,11 @@
.. varnish_vsc_begin:: main
:oneliner: Main counters
:order: 10
:sumfunction:
:sumfunction:
wrk_wrk wrk
.. varnish_vsc:: summs
:level: debug
:group: wrk
:oneliner: stat summ operations
Number of times per-thread statistics were summed into the
...
...
@@ -21,16 +22,19 @@
How long the child process has been running.
.. varnish_vsc:: sess_conn
:group: wrk
:oneliner: Sessions accepted
Count of sessions successfully accepted
.. varnish_vsc:: sess_drop
:group: wrk
:oneliner: Sessions dropped
Count of sessions silently dropped due to lack of worker thread.
.. varnish_vsc:: sess_fail
:group: wrk
:oneliner: Session accept failures
Count of failures to accept TCP connection.
...
...
@@ -39,64 +43,75 @@
give more detailed information.
.. varnish_vsc:: sess_fail_econnaborted
:group: wrk
:oneliner: Session accept failures: connection aborted
Detailed reason for sess_fail: Connection aborted by the
client, usually harmless.
.. varnish_vsc:: sess_fail_eintr
:group: wrk
:oneliner: Session accept failures: interrupted system call
Detailed reason for sess_fail: The accept() call was
interrupted, usually harmless
.. varnish_vsc:: sess_fail_emfile
:group: wrk
:oneliner: Session accept failures: too many open files
Detailed reason for sess_fail: No file descriptor was
available. Consider raising RLIMIT_NOFILE (see ulimit -n).
.. varnish_vsc:: sess_fail_ebadf
:group: wrk
:oneliner: Session accept failures: bad file descriptor
Detailed reason for sess_fail: The listen socket file
descriptor was invalid. Should never happen.
.. varnish_vsc:: sess_fail_enomem
:group: wrk
:oneliner: Session accept failures: not enough memory
Detailed reason for sess_fail: Most likely insufficient
socket buffer memory. Should never happen
.. varnish_vsc:: sess_fail_other
:group: wrk
:oneliner: Session accept failures: other
Detailed reason for sess_fail: neither of the above, see
Debug log (varnishlog -g raw -I Debug:^Accept).
.. varnish_vsc:: client_req_400
:group: wrk
:oneliner: Client requests received, subject to 400 errors
400 means we couldn't make sense of the request, it was malformed
in some drastic way.
.. varnish_vsc:: client_req_417
:group: wrk
:oneliner: Client requests received, subject to 417 errors
417 means that something went wrong with an Expect: header.
.. varnish_vsc:: client_req
:group: wrk
:oneliner: Good client requests received
The count of parseable client requests seen.
.. varnish_vsc:: cache_hit
:group: wrk
:oneliner: Cache hits
Count of cache hits. A cache hit indicates that an object has been
delivered to a client without fetching it from a backend server.
.. varnish_vsc:: cache_hit_grace
:group: wrk
:oneliner: Cache grace hits
Count of cache hits with grace. A cache hit with grace is a cache
...
...
@@ -104,6 +119,7 @@
included in the cache_hit counter.
.. varnish_vsc:: cache_hitpass
:group: wrk
:oneliner: Cache hits for pass.
Count of hits for pass. A cache hit for pass indicates that Varnish
...
...
@@ -112,6 +128,7 @@
decision is being used.
.. varnish_vsc:: cache_hitmiss
:group: wrk
:oneliner: Cache hits for miss.
Count of hits for miss. A cache hit for miss indicates that Varnish
...
...
@@ -120,6 +137,7 @@
cached decision is being used.
.. varnish_vsc:: cache_miss
:group: wrk
:oneliner: Cache misses
Count of misses. A cache miss indicates the object was fetched from
...
...
@@ -161,56 +179,67 @@
.. varnish_vsc:: fetch_head
:group: wrk
:oneliner: Fetch no body (HEAD)
beresp with no body because the request is HEAD.
.. varnish_vsc:: fetch_length
:group: wrk
:oneliner: Fetch with Length
beresp.body with Content-Length.
.. varnish_vsc:: fetch_chunked
:group: wrk
:oneliner: Fetch chunked
beresp.body with Chunked.
.. varnish_vsc:: fetch_eof
:group: wrk
:oneliner: Fetch EOF
beresp.body with EOF.
.. varnish_vsc:: fetch_bad
:group: wrk
:oneliner: Fetch bad T-E
beresp.body length/fetch could not be determined.
.. varnish_vsc:: fetch_none
:group: wrk
:oneliner: Fetch no body
beresp.body empty
.. varnish_vsc:: fetch_1xx
:group: wrk
:oneliner: Fetch no body (1xx)
beresp with no body because of 1XX response.
.. varnish_vsc:: fetch_204
:group: wrk
:oneliner: Fetch no body (204)
beresp with no body because of 204 response.
.. varnish_vsc:: fetch_304
:group: wrk
:oneliner: Fetch no body (304)
beresp with no body because of 304 response.
.. varnish_vsc:: fetch_failed
:group: wrk
:oneliner: Fetch failed (all causes)
beresp fetch failed.
.. varnish_vsc:: fetch_no_thread
:group: wrk
:oneliner: Fetch failed (no thread)
beresp fetch failed, no thread available.
...
...
@@ -259,12 +288,14 @@
per second. See also parameter thread_queue_limit.
.. varnish_vsc:: busy_sleep
:group: wrk
:oneliner: Number of requests sent to sleep on busy objhdr
Number of requests sent to sleep without a worker thread because
they found a busy object.
.. varnish_vsc:: busy_wakeup
:group: wrk
:oneliner: Number of requests woken after sleep on busy objhdr
Number of requests taken off the busy object sleep list and rescheduled.
...
...
@@ -295,6 +326,7 @@
.. varnish_vsc:: n_object
:type: gauge
:group: wrk
:oneliner: object structs made
Approximate number of HTTP objects (headers + body, if present) in
...
...
@@ -303,12 +335,14 @@
.. varnish_vsc:: n_vampireobject
:type: gauge
:level: diag
:group: wrk
:oneliner: unresurrected objects
Number of unresurrected objects
.. varnish_vsc:: n_objectcore
:type: gauge
:group: wrk
:oneliner: objectcore structs made
Approximate number of object metadata elements in the cache. Each
...
...
@@ -317,6 +351,7 @@
.. varnish_vsc:: n_objecthead
:type: gauge
:group: wrk
:oneliner: objecthead structs made
Approximate number of different hash entries in the cache.
...
...
@@ -358,72 +393,83 @@
.. varnish_vsc:: s_sess
:group: wrk
:oneliner: Total sessions seen
.. varnish_vsc:: s_pipe
:group: wrk
:oneliner: Total pipe sessions seen
.. varnish_vsc:: s_pass
:group: wrk
:oneliner: Total pass-ed requests seen
.. varnish_vsc:: s_fetch
:group: wrk
:oneliner: Total backend fetches initiated
.. varnish_vsc:: s_synth
:group: wrk
:oneliner: Total synthetic responses made
.. varnish_vsc:: s_req_hdrbytes
:oneliner: Request header bytes
:format: bytes
:group: wrk
:oneliner: Request header bytes
Total request header bytes received
.. varnish_vsc:: s_req_bodybytes
:oneliner: Request body bytes
:format: bytes
:group: wrk
:oneliner: Request body bytes
Total request body bytes received
.. varnish_vsc:: s_resp_hdrbytes
:oneliner: Response header bytes
:format: bytes
:group: wrk
:oneliner: Response header bytes
Total response header bytes transmitted
.. varnish_vsc:: s_resp_bodybytes
:oneliner: Response body bytes
:format: bytes
:group: wrk
:oneliner: Response body bytes
Total response body bytes transmitted
:format: bytes
.. varnish_vsc:: s_pipe_hdrbytes
:oneliner: Pipe request header bytes
:format: bytes
:group: wrk
:oneliner: Pipe request header bytes
Total request bytes received for piped sessions
.. varnish_vsc:: s_pipe_in
:oneliner: Piped bytes from client
:format: bytes
:group: wrk
:oneliner: Piped bytes from client
Total number of bytes forwarded from clients in pipe sessions
.. varnish_vsc:: s_pipe_out
:oneliner: Piped bytes to client
:format: bytes
:group: wrk
:oneliner: Piped bytes to client
Total number of bytes forwarded to clients in pipe sessions
.. varnish_vsc:: sess_closed
:group: wrk
:oneliner: Session Closed
.. varnish_vsc:: sess_closed_err
:oneliner: Session Closed with error
...
...
@@ -431,11 +477,12 @@
for detailed breakdown
.. varnish_vsc:: sess_readahead
:group: wrk
:oneliner: Session Read Ahead
.. varnish_vsc:: sess_herd
:level: diag
:group: wrk
:oneliner: Session herd
Number of times the timeout_linger triggered
...
...
@@ -589,6 +636,7 @@
.. varnish_vsc:: vcl_fail
:group: wrk
:oneliner: VCL failures
Count of failures which prevented VCL from completing.
...
...
@@ -754,6 +802,7 @@
Number of objects received by expiry thread for handling.
.. varnish_vsc:: hcb_nolock
:group: wrk
:level: debug
:oneliner: HCB Lookups without lock
...
...
bin/varnishd/cache/cache.h
View file @
79101ecc
...
...
@@ -86,6 +86,7 @@ enum {
struct
VSC_lck
;
struct
VSC_main
;
struct
VSC_main_wrk
;
struct
backend
;
struct
ban
;
struct
ban_proto
;
...
...
@@ -246,7 +247,7 @@ struct worker {
struct
objhead
*
nobjhead
;
struct
objcore
*
nobjcore
;
void
*
nhashpriv
;
struct
VSC_main
*
stats
;
struct
VSC_main
_wrk
*
stats
;
struct
vsl_log
*
vsl
;
// borrowed from req/bo
struct
pool_task
task
;
...
...
bin/varnishd/cache/cache_pool.c
View file @
79101ecc
...
...
@@ -50,20 +50,12 @@ static VTAILQ_HEAD(,pool) pools = VTAILQ_HEAD_INITIALIZER(pools);
* Summing of stats into global stats counters
*/
static
void
pool_sumstat
(
const
struct
VSC_main
*
src
)
{
Lck_AssertHeld
(
&
wstat_mtx
);
VSC_main_Summ
(
VSC_C_main
,
src
);
}
void
Pool_Sumstat
(
const
struct
worker
*
wrk
)
{
Lck_Lock
(
&
wstat_mtx
);
pool_sumstat
(
wrk
->
stats
);
VSC_main_Summ_wrk
(
VSC_C_main
,
wrk
->
stats
);
Lck_Unlock
(
&
wstat_mtx
);
memset
(
wrk
->
stats
,
0
,
sizeof
*
wrk
->
stats
);
}
...
...
@@ -73,7 +65,7 @@ Pool_TrySumstat(const struct worker *wrk)
{
if
(
Lck_Trylock
(
&
wstat_mtx
))
return
(
0
);
pool_sumstat
(
wrk
->
stats
);
VSC_main_Summ_wrk
(
VSC_C_main
,
wrk
->
stats
);
Lck_Unlock
(
&
wstat_mtx
);
memset
(
wrk
->
stats
,
0
,
sizeof
*
wrk
->
stats
);
return
(
1
);
...
...
@@ -121,14 +113,14 @@ Pool_PurgeStat(unsigned nobj)
void
v_matchproto_
(
task_func_t
)
pool_stat_summ
(
struct
worker
*
wrk
,
void
*
priv
)
{
struct
VSC_main
*
src
;
struct
VSC_main
_wrk
*
src
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
->
pool
,
POOL_MAGIC
);
AN
(
priv
);
src
=
priv
;
Lck_Lock
(
&
wstat_mtx
);
pool_sumstat
(
src
);
VSC_main_Summ_wrk
(
VSC_C_main
,
src
);
Lck_Unlock
(
&
wstat_mtx
);
memset
(
src
,
0
,
sizeof
*
src
);
AZ
(
wrk
->
pool
->
b_stat
);
...
...
bin/varnishd/cache/cache_pool.h
View file @
79101ecc
...
...
@@ -53,8 +53,8 @@ struct pool {
uintmax_t
sdropped
;
uintmax_t
rdropped
;
uintmax_t
nqueued
;
struct
VSC_main
*
a_stat
;
struct
VSC_main
*
b_stat
;
struct
VSC_main
_wrk
*
a_stat
;
struct
VSC_main
_wrk
*
b_stat
;
struct
mempool
*
mpl_req
;
struct
mempool
*
mpl_sess
;
...
...
bin/varnishd/cache/cache_req.c
View file @
79101ecc
...
...
@@ -44,7 +44,7 @@
#include "vtim.h"
void
Req_AcctLogCharge
(
struct
VSC_main
*
ds
,
struct
req
*
req
)
Req_AcctLogCharge
(
struct
VSC_main
_wrk
*
ds
,
struct
req
*
req
)
{
struct
acct_req
*
a
;
...
...
bin/varnishd/cache/cache_varnishd.h
View file @
79101ecc
...
...
@@ -318,7 +318,7 @@ void Req_Release(struct req *);
void
Req_Rollback
(
struct
req
*
req
);
void
Req_Cleanup
(
struct
sess
*
sp
,
struct
worker
*
wrk
,
struct
req
*
req
);
void
Req_Fail
(
struct
req
*
req
,
enum
sess_close
reason
);
void
Req_AcctLogCharge
(
struct
VSC_main
*
,
struct
req
*
);
void
Req_AcctLogCharge
(
struct
VSC_main
_wrk
*
,
struct
req
*
);
/* cache_req_body.c */
int
VRB_Ignore
(
struct
req
*
);
...
...
bin/varnishd/cache/cache_wrk.c
View file @
79101ecc
...
...
@@ -61,7 +61,7 @@ wrk_bgthread(void *arg)
{
struct
bgthread
*
bt
;
struct
worker
wrk
;
struct
VSC_main
ds
;
struct
VSC_main
_wrk
ds
;
CAST_OBJ_NOTNULL
(
bt
,
arg
,
BGTHREAD_MAGIC
);
THR_SetName
(
bt
->
name
);
...
...
@@ -98,7 +98,7 @@ WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace)
{
// child_signal_handler stack overflow check uses struct worker addr
struct
worker
*
w
,
ww
;
struct
VSC_main
ds
;
struct
VSC_main
_wrk
ds
;
unsigned
char
ws
[
thread_workspace
];
AN
(
qp
);
...
...
@@ -133,11 +133,11 @@ WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace)
*/
static
void
pool_addstat
(
struct
VSC_main
*
dst
,
struct
VSC_main
*
src
)
pool_addstat
(
struct
VSC_main
_wrk
*
dst
,
struct
VSC_main_wrk
*
src
)
{
dst
->
summs
++
;
VSC_main_Summ
(
dst
,
src
);
VSC_main_Summ
_wrk_wrk
(
dst
,
src
);
memset
(
src
,
0
,
sizeof
*
src
);
}
...
...
lib/libvcc/vsctool.py
View file @
79101ecc
...
...
@@ -93,6 +93,7 @@ class CounterSet(object):
self
.
head
=
m
self
.
completed
=
False
self
.
off
=
0
self
.
gnames
=
None
def
addmbr
(
self
,
m
,
g
):
'''Add a counter'''
...
...
@@ -168,7 +169,13 @@ class CounterSet(object):
fo
.
write
(
self
.
struct
+
" {
\n
"
)
for
i
in
self
.
mbrs
:
fo
.
write
(
"
\t
uint64_t
\t
%
s;
\n
"
%
i
.
arg
)
s
=
"
\t
uint64_t
\t
%
s;"
%
i
.
arg
g
=
i
.
param
.
get
(
"group"
)
if
g
is
not
None
:
while
len
(
s
.
expandtabs
())
<
64
:
s
+=
"
\t
"
s
+=
"/*
%
s */"
%
g
fo
.
write
(
s
+
"
\n
"
)
fo
.
write
(
"};
\n
"
)
fo
.
write
(
"
\n
"
)
...
...
@@ -189,14 +196,19 @@ class CounterSet(object):
fo
.
write
(
"void VSC_"
+
self
.
name
+
"_Destroy"
)
fo
.
write
(
"(struct vsc_seg **);
\n
"
)
if
'sumfunction'
in
self
.
head
.
param
:
fo
.
write
(
"void VSC_"
+
self
.
name
+
"_Summ"
)
fo
.
write
(
"("
+
self
.
struct
+
" *, "
)
fo
.
write
(
"const "
+
self
.
struct
+
" *);
\n
"
)
for
i
in
self
.
gnames
:
fo
.
write
(
"void VSC_"
+
self
.
name
+
"_Summ_"
+
i
)
fo
.
write
(
"("
+
self
.
struct
+
" *, "
)
fo
.
write
(
"const "
+
self
.
struct
+
"_"
+
i
+
" *);
\n
"
)
sf
=
self
.
head
.
param
.
get
(
'sumfunction'
)
if
sf
is
not
None
:
for
i
in
sf
.
split
():
j
=
i
.
split
(
"_"
)
assert
len
(
j
)
<=
2
if
len
(
j
)
==
1
:
fo
.
write
(
"void VSC_"
+
self
.
name
+
"_Summ_"
+
i
)
fo
.
write
(
"("
+
self
.
struct
+
" *, "
)
fo
.
write
(
"const "
+
self
.
struct
+
"_"
+
i
+
" *);
\n
"
)
else
:
fo
.
write
(
"void VSC_"
+
self
.
name
+
"_Summ_"
+
i
)
fo
.
write
(
"("
+
self
.
struct
+
"_"
+
j
[
0
]
+
" *, "
)
fo
.
write
(
"const "
+
self
.
struct
+
"_"
+
j
[
1
]
+
" *);
\n
"
)
def
emit_c_paranoia
(
self
,
fo
):
'''Emit asserts to make sure compiler gets same byte index'''
...
...
@@ -211,27 +223,23 @@ class CounterSet(object):
fo
.
write
(
"#undef PARANOIA
\n
"
)
def
emit_c_sumfunc
(
self
,
fo
,
g
=
None
):
def
emit_c_sumfunc
(
self
,
fo
,
tgt
):
'''Emit a function summ up countersets'''
fo
.
write
(
"
\n
"
)
fo
.
write
(
"void
\n
"
)
fo
.
write
(
"VSC_"
+
self
.
name
+
"_Summ"
)
if
g
is
not
None
:
fo
.
write
(
"_"
+
g
)
fo
.
write
(
"("
+
self
.
struct
+
" *dst, "
)
fo
.
write
(
"const "
+
self
.
struct
)
if
g
is
not
Non
e
:
fo
.
write
(
"
_"
+
g
)
fo
.
write
(
" *src)
\n
"
)
fo
.
write
(
"_"
+
tgt
[
0
])
if
len
(
tgt
)
>
1
:
fo
.
write
(
"_"
+
tgt
[
1
]
)
fo
.
write
(
"("
+
self
.
struct
+
"_"
+
tgt
[
1
]
)
els
e
:
fo
.
write
(
"
("
+
self
.
struct
)
fo
.
write
(
" *
dst, const "
+
self
.
struct
+
"_"
+
tgt
[
0
]
+
" *
src)
\n
"
)
fo
.
write
(
"{
\n
"
)
fo
.
write
(
"
\n
"
)
fo
.
write
(
"
\t
AN(dst);
\n
"
)
fo
.
write
(
"
\t
AN(src);
\n
"
)
if
g
:
l
=
self
.
groups
[
g
]
else
:
l
=
self
.
mbrs
for
i
in
l
:
for
i
in
self
.
groups
[
tgt
[
0
]]:
s1
=
"
\t
dst->"
+
i
.
arg
+
" +="
s2
=
"src->"
+
i
.
arg
+
";"
if
len
((
s1
+
" "
+
s2
)
.
expandtabs
())
<
79
:
...
...
@@ -300,10 +308,10 @@ class CounterSet(object):
self
.
emit_json
(
fo
)
self
.
emit_c_newfunc
(
fo
)
self
.
emit_c_destroyfunc
(
fo
)
if
'sumfunction'
in
self
.
head
.
param
:
self
.
emit_c_sumfunc
(
fo
)
for
i
in
s
elf
.
gnames
:
self
.
emit_c_sumfunc
(
fo
,
i
)
sf
=
self
.
head
.
param
.
get
(
'sumfunction'
)
if
sf
is
not
None
:
for
i
in
s
f
.
split
()
:
self
.
emit_c_sumfunc
(
fo
,
i
.
split
(
"_"
)
)
#######################################################################
...
...
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