blob: 6d576b8dbfac080e8c6466d486ccb98586cc2fc0 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 include/types/backend.h
matt.farnsworth@nokia.com1c2ab962008-04-14 20:47:37 +02003 This file assembles definitions for backends
Willy Tarreaubaaee002006-06-26 02:48:02 +02004
Willy Tarreau51406232008-03-10 22:04:20 +01005 Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
Willy Tarreaubaaee002006-06-26 02:48:02 +02006
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation, version 2.1
10 exclusively.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/
21
22#ifndef _TYPES_BACKEND_H
23#define _TYPES_BACKEND_H
24
Willy Tarreaue3ba5f02006-06-29 18:54:54 +020025#include <common/config.h>
26
Willy Tarreaudf366142007-11-30 16:23:20 +010027/* Parameters for proxy->lbprm.algo.
28 * The low part of the value is unique for each algo so that applying the mask
29 * BE_LB_ALGO returns a unique algorithm.
30 * The high part indicates specific properties.
31 */
32
33/* Masks to extract algorithm properties */
34#define BE_LB_ALGO 0x000007FF /* mask to extract all algorithm flags */
35#define BE_LB_PROP_DYN 0x00000100 /* mask to match dynamic algorithms */
36#define BE_LB_PROP_L4 0x00000200 /* mask to match layer4-based algorithms */
37#define BE_LB_PROP_L7 0x00000400 /* mask to match layer7-based algorithms */
38
39/* the algorithms themselves */
40#define BE_LB_ALGO_NONE 0x00000000 /* dispatch or transparent mode */
41#define BE_LB_ALGO_RR (BE_LB_PROP_DYN | 0x01) /* fast weighted round-robin mode (dynamic) */
42#define BE_LB_ALGO_SH (BE_LB_PROP_L4 | 0x02) /* balance on source IP hash */
43#define BE_LB_ALGO_UH (BE_LB_PROP_L7 | 0x03) /* balance on URI hash */
44#define BE_LB_ALGO_PH (BE_LB_PROP_L7 | 0x04) /* balance on URL parameter hash */
Willy Tarreau51406232008-03-10 22:04:20 +010045#define BE_LB_ALGO_LC (BE_LB_PROP_DYN | 0x05) /* fast weighted round-robin mode (dynamic) */
Willy Tarreaub625a082007-11-26 01:15:43 +010046
47/* various constants */
Willy Tarreaub698f0f2007-12-02 11:01:23 +010048
matt.farnsworth@nokia.com1c2ab962008-04-14 20:47:37 +020049/* The scale factor between user weight and effective weight allows smooth
Willy Tarreaub698f0f2007-12-02 11:01:23 +010050 * weight modulation even with small weights (eg: 1). It should not be too high
51 * though because it limits the number of servers in FWRR mode in order to
52 * prevent any integer overflow. The max number of servers per backend is
53 * limited to about 2^32/255^2/scale ~= 66051/scale. A scale of 16 looks like
54 * a good value, as it allows more than 4000 servers per backend while leaving
55 * modulation steps of about 6% for servers with the lowest weight (1).
56 */
57#define BE_WEIGHT_SCALE 16
Willy Tarreaub625a082007-11-26 01:15:43 +010058
Willy Tarreaubaaee002006-06-26 02:48:02 +020059#endif /* _TYPES_BACKEND_H */
60
61/*
62 * Local variables:
63 * c-indent-level: 8
64 * c-basic-offset: 8
65 * End:
66 */