Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-weightadjust
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
libvmod-weightadjust
Commits
1d1cd573
Commit
1d1cd573
authored
Sep 28, 2017
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial vcc
parent
33c7cf9a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
14 deletions
+65
-14
configure.ac
configure.ac
+1
-1
vmod_weightadjust.vcc
src/vmod_weightadjust.vcc
+64
-13
No files found.
configure.ac
View file @
1d1cd573
AC_PREREQ([2.68])
AC_INIT([libvmod-weightadjust], [0.1], [], [vmod-weightadjust])
AC_COPYRIGHT([
Public Domain
])
AC_COPYRIGHT([
2013-2015 Varnish Software AS, 2017 UPLEX Nils Goroll Systemoptimierung
])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR(src/vmod_weightadjust.vcc)
...
...
src/vmod_weightadjust.vcc
View file @
1d1cd573
...
...
@@ -9,22 +9,73 @@ $Module weightadjust 3 Weightadjust VMOD
DESCRIPTION
===========
This is the embedded documentation for the weightadjust VMOD. It should
mention what the vmod is intended to do.
$Event event_function
It can span multiple lines and is written in RST format.
You can even have links and lists in here:
$Object random()
* https://github.com/varnish/libvmod-weightadjust/
* https://www.varnish-cache.org/
Description
Create a random backend director.
$Event event_function
$Function STRING info()
The random director distributes load over the backends using
a weighted random probability distribution.
The "testable" random generator in varnishd is used, which
enables deterministic tests to be run (See: d00004.vtc).
Example
new vdir = directors.random();
$Method VOID .add_backend(BACKEND backend, REAL weight,
STRING weight_update=0,
STRING url="/",
STRING request=0,
DURATION timeout=2,
DURATION interval=5,
INT buffer=4096)
Description
Add a *backend* to the director with a given initial *weight*.
Each backend will receive approximately 100 * (weight /
(sum(all_added_weights))) per cent of the traffic sent to this
director.
If a regular expression *weight_update* is given, the weight
assigned to this backend is updated by a HTTP1 request defined
by either *url* or the string *request*, the latter having
precedence if given.
The *weight_update* regular expression needs to contain
exactly one subexpression to capture a real value in C locale
format (ddd.ddd). The match is ran against the first *buffer*
bytes of the HTTP response, headers and body in multiline mode
(``^`` matches start of line, ``$`` matches end of line or end buffer).
The interval to issue weight update requests is defined by the
*interval* parameter, the timeout both for sending and
receiving all of the request and response, respectively, is
deined by *timeout*. Note that the actual interval can be
longer than specified if the combined request and response
time exceeds it.
The *buffer* parameter defines a maximum size for the http
response, headers and body.
Example
# 2/3 to backend1, 1/3 to backend2.
vdir.add_backend(backend1, 10.0);
vdir.add_backend(backend2, 5.0);
$Method VOID .remove_backend(BACKEND)
Returns a string set by the last VCL event, demonstrating the use of
event functions.
Description
Remove a backend from the director.
Example
vdir.remove_backend(backend1);
vdir.remove_backend(backend2);
$
Function STRING hello(STRING
)
$
Method BACKEND .backend(
)
The different functions provided by the VMOD should also have their own
embedded documentation. This section is for the hello() function.
Description
Pick a backend from the director.
Example
set req.backend_hint = vdir.backend();
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