Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
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
slash
Commits
a66168c0
Unverified
Commit
a66168c0
authored
Dec 14, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a precise gauge of the number of objects in memory (in fdb tree)
Related to #45
parent
434b43bd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
5 deletions
+27
-5
CHANGES.rst
CHANGES.rst
+2
-0
VSC_fellow.vsc
src/VSC_fellow.vsc
+7
-0
fellow_cache.c
src/fellow_cache.c
+16
-3
fellow_cache.h
src/fellow_cache.h
+1
-1
fellow_storage.c
src/fellow_storage.c
+1
-1
No files found.
CHANGES.rst
View file @
a66168c0
...
...
@@ -25,6 +25,8 @@ fellow
* Improved code coverage and added Coverity for additional linting.
* Added g_mem_obj gauge.
* Added an absolute maximum of 31 and dynamic maximum to the readahead
parameter to avoid single object deliveries holding more than 1/16
of the available memory cache.
...
...
src/VSC_fellow.vsc
View file @
a66168c0
...
...
@@ -120,6 +120,13 @@
Note: This number is only approximate
.. varnish_vsc:: g_mem_obj
:type: gauge
:level: info
:oneliner: Objects in memory
Exact number of objects currently in memory (fco_infdb).
.. varnish_vsc:: g_dsk_bytes
:type: gauge
:level: info
...
...
src/fellow_cache.c
View file @
a66168c0
...
...
@@ -759,6 +759,7 @@ struct fellow_cache {
pthread_mutex_t
fdb_mtx
;
struct
fellow_cache_fdb_head
fdb_head
;
uint64_t
*
g_mem_obj
;
// stats
struct
fellow_cache_lrus
lrus
[
1
];
...
...
@@ -1600,6 +1601,8 @@ fellow_cache_obj_evict_mutate(const struct fellow_cache_lru *lru,
AN
(
FCO_REFCNT
(
fco
));
AZ
(
pthread_mutex_lock
(
&
fc
->
fdb_mtx
));
(
void
)
VRBT_REMOVE
(
fellow_cache_fdb_head
,
&
fc
->
fdb_head
,
fco
);
AN
(
*
fc
->
g_mem_obj
);
(
*
fc
->
g_mem_obj
)
--
;
AZ
(
pthread_mutex_unlock
(
&
fc
->
fdb_mtx
));
// state, oc (relevant for lru)
...
...
@@ -2655,6 +2658,7 @@ fellow_cache_obj_unbusy(struct fellow_busy *fbo, enum fcol_state wantlog)
AZ
(
pthread_mutex_lock
(
&
fc
->
fdb_mtx
));
ofco
=
VRBT_INSERT
(
fellow_cache_fdb_head
,
&
fc
->
fdb_head
,
fco
);
AZ
(
ofco
);
(
*
fc
->
g_mem_obj
)
++
;
AZ
(
pthread_mutex_unlock
(
&
fc
->
fdb_mtx
));
if
(
likely
(
fco
->
logstate
==
FCOL_DUNNO
))
...
...
@@ -4864,6 +4868,8 @@ fellow_cache_obj_deref_locked(struct fellow_lru_chgbatch *lcb,
/* REF_FDB_REMOVE */
AZ
(
pthread_mutex_lock
(
&
fc
->
fdb_mtx
));
(
void
)
VRBT_REMOVE
(
fellow_cache_fdb_head
,
&
fc
->
fdb_head
,
fco
);
AN
(
*
fc
->
g_mem_obj
);
(
*
fc
->
g_mem_obj
)
--
;
AZ
(
pthread_mutex_unlock
(
&
fc
->
fdb_mtx
));
}
return
(
refcnt
);
...
...
@@ -4947,6 +4953,7 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
else
if
(
ocp
)
{
AZ
(
nfco
->
oc
);
TAKE_OBJ_NOTNULL
(
nfco
->
oc
,
ocp
,
OBJCORE_MAGIC
);
(
*
fc
->
g_mem_obj
)
++
;
}
AZ
(
pthread_mutex_unlock
(
&
fc
->
fdb_mtx
));
...
...
@@ -5389,7 +5396,7 @@ fellow_cache_assert_disk_fmt(void)
struct
fellow_cache
*
fellow_cache_init
(
struct
fellow_fd
*
ffd
,
buddy_t
*
membuddy
,
struct
stvfe_tune
*
tune
,
fellow_task_run_t
taskrun
)
struct
stvfe_tune
*
tune
,
fellow_task_run_t
taskrun
,
uint64_t
*
g_mem_obj
)
{
struct
fellow_cache
*
fc
;
...
...
@@ -5410,6 +5417,8 @@ fellow_cache_init(struct fellow_fd *ffd, buddy_t *membuddy,
AZ
(
pthread_mutex_init
(
&
fc
->
fdb_mtx
,
&
fc_mtxattr_errorcheck
));
VRBT_INIT
(
&
fc
->
fdb_head
);
fc
->
g_mem_obj
=
g_mem_obj
;
AZ
(
*
g_mem_obj
);
fellow_cache_async_init
(
fc
,
taskrun
);
...
...
@@ -5435,6 +5444,7 @@ fellow_cache_fini(struct fellow_cache **fcp)
fellow_cache_lrus_fini
(
fc
->
lrus
);
assert
(
VRBT_EMPTY
(
&
fc
->
fdb_head
));
AZ
(
*
fc
->
g_mem_obj
);
fellow_cache_async_fini
(
fc
);
...
...
@@ -6119,6 +6129,7 @@ t_cache(const char *fn, unsigned chksum)
struct
fellow_cache_res
fcr
;
int
injcount
;
char
*
ptr
;
uint64_t
g_mem_obj
=
0
;
DBGSZ
(
fellow_disk_seg
);
DBGSZ
(
fellow_disk_seglist
);
...
...
@@ -6152,7 +6163,8 @@ t_cache(const char *fn, unsigned chksum)
XXXAN
(
ffd
);
fellow_log_open
(
ffd
,
resurrect_discard
,
&
resur_priv
);
fc
=
fellow_cache_init
(
ffd
,
membuddy
,
tune
,
fellow_simple_task_run
);
fc
=
fellow_cache_init
(
ffd
,
membuddy
,
tune
,
fellow_simple_task_run
,
&
g_mem_obj
);
t_lcb
(
fc
);
...
...
@@ -6439,8 +6451,9 @@ t_cache(const char *fn, unsigned chksum)
XXXAN
(
ffd
);
fellow_log_open
(
ffd
,
resurrect_keep
,
&
resur_priv
);
AZ
(
g_mem_obj
);
fc
=
fellow_cache_init
(
ffd
,
membuddy
,
tune
,
fellow_simple_task_run
);
fellow_simple_task_run
,
&
g_mem_obj
);
}
}
...
...
src/fellow_cache.h
View file @
a66168c0
...
...
@@ -49,7 +49,7 @@ struct fellow_cache_res {
struct
fellow_cache
*
fellow_cache_init
(
struct
fellow_fd
*
,
buddy_t
*
,
struct
stvfe_tune
*
,
fellow_task_run_t
);
fellow_task_run_t
,
uint64_t
*
);
void
fellow_cache_fini
(
struct
fellow_cache
**
);
void
fellow_cache_obj_delete
(
struct
fellow_cache
*
fc
,
...
...
src/fellow_storage.c
View file @
a66168c0
...
...
@@ -2415,7 +2415,7 @@ sfe_open_scope(struct stevedore *stv)
}
fc
=
fellow_cache_init
(
ffd
,
stvfe
->
membuddy
,
&
stvfe
->
tune
,
sfe_taskrun
);
sfe_taskrun
,
&
stvfe
->
stats
->
g_mem_obj
);
if
(
fc
==
NULL
)
{
/* should never happen, unless we turn assertions into
* errors */
...
...
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