README.rst 1.93 KB
Newer Older
1
============
2
vmod-weightadjust
3 4
============

Nils Goroll's avatar
Nils Goroll committed
5
This version is for varnish 6.2
Nils Goroll's avatar
Nils Goroll committed
6

7 8 9
SYNOPSIS
========

10
import weightadjust;
11 12 13 14

DESCRIPTION
===========

Nils Goroll's avatar
Nils Goroll committed
15 16
Random director with dynamic weight update based on http requests to
backends.
17

Nils Goroll's avatar
Nils Goroll committed
18
Example:
19

Nils Goroll's avatar
Nils Goroll committed
20
::
21

Nils Goroll's avatar
Nils Goroll committed
22
   vcl_init {
23
        new director = random();
24

25 26 27 28
        director.add_backend(backend,
                             weight=1.1,
                             weight_update="^X-Weight: *(\d+\.\d+)",
                             url="/get-weight.php");
Nils Goroll's avatar
Nils Goroll committed
29 30 31
   # ...
   }

Nils Goroll's avatar
Nils Goroll committed
32
See vmod documentation/man page for details.
33 34 35 36 37 38

INSTALLATION
============

The source tree is based on autotools to configure the building, and
does also have the necessary bits in place to do functional unit tests
39
using the ``varnishtest`` tool.
40

41 42
Building requires the Varnish header files and uses pkg-config to find
the necessary paths.
43

44
Usage::
45

46 47
 ./autogen.sh
 ./configure
48

49 50
If you have installed Varnish to a non-standard directory, call
``autogen.sh`` and ``configure`` with ``PKG_CONFIG_PATH`` pointing to
51
the appropriate path. For instance, when varnishd configure was called
52 53
with ``--prefix=$PREFIX``, use

54 55 56 57 58 59 60 61
::

 export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
 export ACLOCAL_PATH=${PREFIX}/share/aclocal

The module will inherit its prefix from Varnish, unless you specify a
different ``--prefix`` when running the ``configure`` script for this
module.
62 63 64

Make targets:

65 66
* make - builds the vmod.
* make install - installs your vmod.
67
* make check - runs the unit tests in ``src/tests/*.vtc``.
68
* make distcheck - run check and prepare a tarball of the vmod.
69

70 71 72 73 74 75
If you build a dist tarball, you don't need any of the autotools or
pkg-config. You can build the module simply by running::

 ./configure
 make

76 77 78
Installation directories
------------------------

79 80 81
By default, the vmod ``configure`` script installs the built vmod in the
directory relevant to the prefix. The vmod installation directory can be
overridden by passing the ``vmoddir`` variable to ``make install``.
82