Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
86dac723
Commit
86dac723
authored
Dec 14, 2012
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep track of persisted ban byte usage, and it's fragmentation.
parent
007a9085
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
cache_ban.c
bin/varnishd/cache/cache_ban.c
+14
-3
vsc_f_main.h
include/tbl/vsc_f_main.h
+9
-0
No files found.
bin/varnishd/cache/cache_ban.c
View file @
86dac723
...
...
@@ -262,13 +262,16 @@ ban_equal(const uint8_t *bs1, const uint8_t *bs2)
static
void
ban_mark_gone
(
struct
ban
*
b
)
{
unsigned
ln
;
CHECK_OBJ_NOTNULL
(
b
,
BAN_MAGIC
);
ln
=
ban_len
(
b
->
spec
);
b
->
flags
|=
BAN_F_GONE
;
b
->
spec
[
BANS_FLAGS
]
|=
BANS_FLAG_GONE
;
VWMB
();
vbe32enc
(
b
->
spec
+
BANS_LENGTH
,
0
);
VSC_C_main
->
bans_gone
++
;
VSC_C_main
->
bans_persisted_fragmentation
+=
ln
-
ban_len
(
b
->
spec
);
}
/*--------------------------------------------------------------------
...
...
@@ -484,6 +487,7 @@ BAN_Insert(struct ban *b)
* the stevedores has been opened, but before any new objects
* can have entered the cache (thus no objects in the mean
* time depending on ban_magic in the list) */
VSC_C_main
->
bans_persisted_bytes
+=
ln
;
if
(
b
!=
ban_magic
)
ban_info
(
BI_NEW
,
b
->
spec
,
ln
);
/* Notify stevedores */
Lck_Unlock
(
&
ban_mtx
);
...
...
@@ -584,17 +588,21 @@ ban_export(void)
{
struct
ban
*
b
;
struct
vsb
vsb
;
unsigned
ln
;
Lck_AssertHeld
(
&
ban_mtx
);
/* XXX: Use the ban entry size measurements to hit the target
* and avoid multiple allocations */
AN
(
VSB_new
(
&
vsb
,
NULL
,
64
*
VSC_C_main
->
bans
,
VSB_AUTOEXTEND
));
ln
=
VSC_C_main
->
bans_persisted_bytes
-
VSC_C_main
->
bans_persisted_fragmentation
;
AN
(
VSB_new
(
&
vsb
,
NULL
,
ln
,
VSB_AUTOEXTEND
));
VTAILQ_FOREACH_REVERSE
(
b
,
&
ban_head
,
banhead_s
,
list
)
{
AZ
(
VSB_bcat
(
&
vsb
,
b
->
spec
,
ban_len
(
b
->
spec
)));
}
AZ
(
VSB_finish
(
&
vsb
));
assert
(
VSB_len
(
&
vsb
)
==
ln
);
STV_BanExport
((
const
uint8_t
*
)
VSB_data
(
&
vsb
),
VSB_len
(
&
vsb
));
VSB_delete
(
&
vsb
);
VSC_C_main
->
bans_persisted_bytes
=
ln
;
VSC_C_main
->
bans_persisted_fragmentation
=
0
;
}
static
void
...
...
@@ -665,6 +673,7 @@ ban_reload(const uint8_t *ban, unsigned len)
VTAILQ_INSERT_TAIL
(
&
ban_head
,
b2
,
list
);
else
VTAILQ_INSERT_BEFORE
(
b
,
b2
,
list
);
VSC_C_main
->
bans_persisted_bytes
+=
len
;
/* Hunt down older duplicates */
for
(
b
=
VTAILQ_NEXT
(
b2
,
list
);
b
!=
NULL
;
b
=
VTAILQ_NEXT
(
b
,
list
))
{
...
...
@@ -930,6 +939,8 @@ ban_cleantail(void)
VSC_C_main
->
bans
--
;
VSC_C_main
->
bans_deleted
++
;
VTAILQ_REMOVE
(
&
ban_head
,
b
,
list
);
VSC_C_main
->
bans_persisted_fragmentation
+=
ban_len
(
b
->
spec
);
ban_info
(
BI_DROP
,
b
->
spec
,
ban_len
(
b
->
spec
));
}
else
{
b
=
NULL
;
...
...
include/tbl/vsc_f_main.h
View file @
86dac723
...
...
@@ -505,6 +505,15 @@ VSC_F(bans_dups, uint64_t, 0, 'c',
"Bans superseded by other bans"
,
"Count of bans replaced by later identical bans."
)
VSC_F
(
bans_persisted_bytes
,
uint64_t
,
0
,
'g'
,
"Bytes used by the persisted ban lists"
,
"Number of bytes used by the persisted ban lists."
)
VSC_F
(
bans_persisted_fragmentation
,
uint64_t
,
0
,
'g'
,
"Extra bytes in persisted ban lists due to fragmentation"
,
"Number of extra bytes accumulated through dropped and"
" gone bans in the persistent ban lists."
)
/*--------------------------------------------------------------------*/
...
...
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