Commit 1d1cd573 authored by Nils Goroll's avatar Nils Goroll

initial vcc

parent 33c7cf9a
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)
......
......@@ -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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment