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
e9c77473
Unverified
Commit
e9c77473
authored
Jul 10, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add objsize_max
parent
93578934
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
143 additions
and
10 deletions
+143
-10
CHANGES.rst
CHANGES.rst
+26
-0
fellow_cache.c
src/fellow_cache.c
+5
-0
fellow_storage.c
src/fellow_storage.c
+4
-0
fellow_tune.c
src/fellow_tune.c
+3
-0
fellow_tunables.h
src/tbl/fellow_tunables.h
+1
-0
vmod_slash.man.rst
src/vmod_slash.man.rst
+20
-6
vmod_slash.vcc
src/vmod_slash.vcc
+16
-2
fellow_coverage.vtc
src/vtc/fellow_coverage.vtc
+68
-2
No files found.
CHANGES.rst
0 → 100644
View file @
e9c77473
..
Copyright 2023 UPLEX Nils Goroll Systemoptimierung
SPDX-License-Identifier: BSD-2-Clause
See LICENSE file for full text of license
===================
About this document
===================
.. keep this section at the top!
This document contains a log of noteworthy changes to SLASH/ from new
to old.
==============
SLASH/ Changes
==============
* The ``objsize_max`` tunable has been added, which defaults to 1/4 of
*dsksize*.
The tunable is going to be used to allow SLASH/ to make an educated
guess about how much space to allocate in advance when the object
size is not known upfront, for example with *chunked encoding*.
Base of the changelog: e3a454096759cafd30d9008f4b11cc754297b250
src/fellow_cache.c
View file @
e9c77473
...
...
@@ -3553,6 +3553,11 @@ fellow_busy_obj_getspace(struct fellow_busy *fbo, size_t *sz, uint8_t **ptr)
max
=
(
size_t
)
1
<<
fbo
->
fc
->
tune
->
chunk_exponent
;
assert
(
max
<=
FIO_MAX
);
if
(
fbo
->
sz_returned
>=
fbo
->
fc
->
tune
->
objsize_max
)
return
(
FCR_ALLOCFAIL
(
"objsize_max reached"
));
if
(
*
sz
+
fbo
->
sz_returned
>
fbo
->
fc
->
tune
->
objsize_max
)
*
sz
=
fbo
->
fc
->
tune
->
objsize_max
-
fbo
->
sz_returned
;
/*
* for content-length, varnish-cache will ask for less and less.
*
...
...
src/fellow_storage.c
View file @
e9c77473
...
...
@@ -744,6 +744,10 @@ fellow_stream_f(void *priv, unsigned flush, const void *ptr, ssize_t len)
int
r
;
CAST_OBJ_NOTNULL
(
fs
,
priv
,
FELLOW_STREAM_MAGIC
);
if
(
fs
->
state
==
BOS_FAILED
)
return
(
-
1
);
assert
((
fs
->
state
==
BOS_FINISHED
&&
fs
->
available
>=
fs
->
written
)
||
(
fs
->
state
==
BOS_STREAM
&&
fs
->
available
>
fs
->
written
));
assert
(
fs
->
checkpoint
==
fs
->
written
);
...
...
src/fellow_tune.c
View file @
e9c77473
...
...
@@ -100,6 +100,9 @@ stvfe_tune_check(struct stvfe_tune *tune)
tune
->
dsk_reserve_chunks
=
l
;
}
if
(
tune
->
objsize_max
==
0
)
tune
->
objsize_max
=
(
tune
->
dsksz
>>
2
);
//lint --e{685,568} misc const comparisons
#define TUNE(t, n, d, min, max) \
if (tune->n < (min)) \
...
...
src/tbl/fellow_tunables.h
View file @
e9c77473
...
...
@@ -45,6 +45,7 @@ TUNE(uint8_t, wait_table_exponent, 10, 6, 32);
TUNE
(
unsigned
,
dsk_reserve_chunks
,
4
,
2
,
UINT_MAX
);
TUNE
(
unsigned
,
mem_reserve_chunks
,
1
,
0
,
UINT_MAX
);
TUNE
(
size_t
,
objsize_hint
,
256
*
1024
,
4096
,
SIZE_MAX
);
TUNE
(
size_t
,
objsize_max
,
0
,
0
,
SIZE_MAX
);
TUNE
(
size_t
,
discard_immediate
,
256
*
1024
,
4096
,
SIZE_MAX
);
TUNE
(
unsigned
,
readahead
,
2
,
0
,
UINT_MAX
);
TUNE
(
unsigned
,
io_batch_min
,
8
,
1
,
UINT_MAX
);
...
...
src/vmod_slash.man.rst
View file @
e9c77473
...
...
@@ -51,7 +51,7 @@ vcl storage objects and methods
new xfellow = slash.fellow(STRING filename, BYTES dsksize, BYTES memsize, BYTES objsize_hint, BOOL delete)
STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [
BYTES objsize_max], [
INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
STEVEDORE xfellow.storage()
...
...
@@ -68,7 +68,7 @@ vcl functions
STRING tune_buddy(STEVEDORE storage, [INT chunk_exponent], [BYTES chunk_bytes], [INT reserve_chunks], [INT cram])
STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [
BYTES objsize_max], [
INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
vcl loadmasters (storage routers)
---------------------------------
...
...
@@ -479,8 +479,8 @@ will be used (which might fail of insufficient memory is available).
.. _xfellow.tune():
STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT wait_table_exponent], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT wait_table_exponent], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [
BYTES objsize_max], [
INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------
::
...
...
@@ -494,6 +494,7 @@ STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [
[INT dsk_reserve_chunks],
[INT mem_reserve_chunks],
[BYTES objsize_hint],
[BYTES objsize_max],
[INT cram],
[INT readahead],
[BYTES discard_immediate],
...
...
@@ -630,6 +631,18 @@ fellow storage can be fine tuned:
used to (re)size the fixed log space. The value should be chosen as
a safe *lower* bound of average object size.
* *objsize_max*
- unit: bytes
- default: 0
specifies the maxiumum object size which fellow will accept.
The default of ``0`` represents 1/4th of *dsksize*. It is strongly
recommended to not use a value higher than that.
The effectively enforced value is rounded up to 4KB.
* *cram* is documented in `xbuddy.tune()`_
* *readahead*
...
...
@@ -811,8 +824,8 @@ Can only be called from ``vcl_init {}``.
.. _slash.tune_fellow():
STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT wait_table_exponent], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT wait_table_exponent], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [
BYTES objsize_max], [
INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------
::
...
...
@@ -827,6 +840,7 @@ STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_
[INT dsk_reserve_chunks],
[INT mem_reserve_chunks],
[BYTES objsize_hint],
[BYTES objsize_max],
[INT cram],
[INT readahead],
[BYTES discard_immediate],
...
...
src/vmod_slash.vcc
View file @
e9c77473
...
...
@@ -36,7 +36,7 @@ vcl storage objects and methods
new xfellow = slash.fellow(STRING filename, BYTES dsksize, BYTES memsize, BYTES objsize_hint, BOOL delete)
STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
STRING xfellow.tune([INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [
BYTES objsize_max], [
INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
STEVEDORE xfellow.storage()
...
...
@@ -53,7 +53,7 @@ vcl functions
STRING tune_buddy(STEVEDORE storage, [INT chunk_exponent], [BYTES chunk_bytes], [INT reserve_chunks], [INT cram])
STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
STRING tune_fellow(STEVEDORE storage, [INT logbuffer_size], [DURATION logbuffer_flush_interval], [REAL log_rewrite_ratio], [INT chunk_exponent], [BYTES chunk_bytes], [INT dsk_reserve_chunks], [INT mem_reserve_chunks], [BYTES objsize_hint], [
BYTES objsize_max], [
INT cram], [INT readahead], [BYTES discard_immediate], [INT io_batch_min], [INT io_batch_max], [ENUM hash_obj], [ENUM hash_log], [ENUM ioerr_obj], [ENUM ioerr_log], [ENUM allocerr_obj], [ENUM allocerr_log])
vcl loadmasters (storage routers)
---------------------------------
...
...
@@ -433,6 +433,7 @@ $Method STRING .tune(
[ INT dsk_reserve_chunks ],
[ INT mem_reserve_chunks ],
[ BYTES objsize_hint ],
[ BYTES objsize_max ],
[ INT cram ],
[ INT readahead ],
[ BYTES discard_immediate ],
...
...
@@ -568,6 +569,18 @@ fellow storage can be fine tuned:
used to (re)size the fixed log space. The value should be chosen as
a safe *lower* bound of average object size.
* *objsize_max*
- unit: bytes
- default: 0
specifies the maxiumum object size which fellow will accept.
The default of ``0`` represents 1/4th of *dsksize*. It is strongly
recommended to not use a value higher than that.
The effectively enforced value is rounded up to 4KB.
* *cram* is documented in `xbuddy.tune()`_
* *readahead*
...
...
@@ -749,6 +762,7 @@ $Function STRING tune_fellow(
[ INT dsk_reserve_chunks ],
[ INT mem_reserve_chunks ],
[ BYTES objsize_hint ],
[ BYTES objsize_max ],
[ INT cram ],
[ INT readahead ],
[ BYTES discard_immediate ],
...
...
src/vtc/fellow_coverage.vtc
View file @
e9c77473
...
...
@@ -7,7 +7,10 @@ shell -err -expect " fellow file can only be used once" \
-sfellow2=fellow,clashfile,100MB,1MB,64KB \
}
varnish v1 -vcl {
varnish v1 \
-arg "-E${libvmod_slash}" \
-arg "-sfellow1=fellow,fellowfile,1MB,1MB,64KB" \
-vcl {
backend none none;
} -start
...
...
@@ -19,4 +22,67 @@ varnish v1 -errvcl {can only be used on a fellow storage} {
sub vcl_init {
slash.tune_fellow(storage.Transient, chunk_bytes = 1KB);
}
}
\ No newline at end of file
}
server s1 {
rxreq
expect req.url == "/256k"
txresp -bodylen 262144
rxreq
expect req.url == "/256k+1"
txresp -bodylen 262145
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_stream = false;
}
}
client c1 {
txreq -url "/256k"
rxresp
expect resp.status == 200
expect resp.bodylen == 262144
txreq -url "/256k+1"
rxresp
expect resp.status == 503
} -start
client c2 {
txreq -url "/256k"
rxresp
expect resp.status == 200
expect resp.bodylen == 262144
txreq -url "/256k+1"
rxresp
expect resp.status == 503
} -start
client c1 -wait
client c2 -wait
server s1 -wait
server s1 {
rxreq
expect req.url == "/16k"
txresp -bodylen 16384
} -start
varnish v1 -vcl+backend {
import slash;
sub vcl_init {
slash.tune_fellow(storage.fellow1, objsize_max = 12K);
}
sub vcl_backend_response {
set beresp.do_stream = false;
}
}
client c3 {
txreq -url "/16k"
rxresp
expect resp.status == 503
} -run
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