Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 2 | include/common/defaults.h |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 3 | Miscellaneous default values. |
| 4 | |
Willy Tarreau | 6b66f3e | 2008-12-14 17:31:54 +0100 | [diff] [blame] | 5 | Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu |
| 6 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 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 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 22 | #ifndef _COMMON_DEFAULTS_H |
| 23 | #define _COMMON_DEFAULTS_H |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 24 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 25 | /* |
| 26 | * BUFSIZE defines the size of a read and write buffer. It is the maximum |
| 27 | * amount of bytes which can be stored by the proxy for each session. However, |
| 28 | * when reading HTTP headers, the proxy needs some spare space to add or rewrite |
| 29 | * headers if needed. The size of this spare is defined with MAXREWRITE. So it |
| 30 | * is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By |
| 31 | * default, BUFSIZE=16384 bytes and MAXREWRITE=BUFSIZE/2, so the maximum length |
| 32 | * of headers accepted is 8192 bytes, which is in line with Apache's limits. |
| 33 | */ |
| 34 | #ifndef BUFSIZE |
| 35 | #define BUFSIZE 16384 |
| 36 | #endif |
| 37 | |
| 38 | // reserved buffer space for header rewriting |
| 39 | #ifndef MAXREWRITE |
| 40 | #define MAXREWRITE (BUFSIZE / 2) |
| 41 | #endif |
| 42 | |
Willy Tarreau | 6b66f3e | 2008-12-14 17:31:54 +0100 | [diff] [blame] | 43 | /* FORWARD_DEFAULT_SIZE |
| 44 | * Indicates how many bytes may be forwarded at once in low-level stream-socks |
| 45 | * without waking the owner task up. This should be much larger than the buffer |
| 46 | * size. A few megabytes seem appropriate. |
| 47 | */ |
| 48 | #ifndef FORWARD_DEFAULT_SIZE |
| 49 | #define FORWARD_DEFAULT_SIZE (16*1024*1024) |
| 50 | #endif |
| 51 | |
| 52 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 53 | #define REQURI_LEN 1024 |
| 54 | #define CAPTURE_LEN 64 |
| 55 | |
Krzysztof Piotr Oledzki | e6bbd74 | 2007-11-01 00:33:12 +0100 | [diff] [blame] | 56 | // maximum line size when parsing config |
| 57 | #ifndef LINESIZE |
| 58 | #define LINESIZE 2048 |
| 59 | #endif |
| 60 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 61 | // max # args on a configuration line |
Krzysztof Piotr Oledzki | e6bbd74 | 2007-11-01 00:33:12 +0100 | [diff] [blame] | 62 | #define MAX_LINE_ARGS 64 |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 63 | |
Krzysztof Piotr Oledzki | 2c6962c | 2008-03-02 02:42:14 +0100 | [diff] [blame] | 64 | // max # args on a uxts socket |
| 65 | #define MAX_UXST_ARGS 16 |
| 66 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 67 | // max # of added headers per request |
| 68 | #define MAX_NEWHDR 10 |
| 69 | |
| 70 | // max # of matches per regexp |
| 71 | #define MAX_MATCH 10 |
| 72 | |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 73 | // max # of headers in one HTTP request or response |
| 74 | // By default, about 100 headers per 8 kB. |
| 75 | #ifndef MAX_HTTP_HDR |
| 76 | #define MAX_HTTP_HDR ((BUFSIZE+79)/80) |
| 77 | #endif |
| 78 | |
Willy Tarreau | b8949f1 | 2007-03-23 22:39:59 +0100 | [diff] [blame] | 79 | // max # of loops we can perform around a read() which succeeds. |
| 80 | // It's very frequent that the system returns a few TCP segments at a time. |
| 81 | #ifndef MAX_READ_POLL_LOOPS |
| 82 | #define MAX_READ_POLL_LOOPS 4 |
| 83 | #endif |
| 84 | |
Willy Tarreau | 8374918 | 2007-04-15 20:56:27 +0200 | [diff] [blame] | 85 | // same, but for writes. Generally, it's enough to write twice: one time for |
| 86 | // first half of the buffer, and a second time for the last half after a |
| 87 | // wrap-around. |
| 88 | #ifndef MAX_WRITE_POLL_LOOPS |
| 89 | #define MAX_WRITE_POLL_LOOPS 2 |
| 90 | #endif |
| 91 | |
Willy Tarreau | 9641e8f | 2007-03-23 23:02:09 +0100 | [diff] [blame] | 92 | // the number of bytes returned by a read below which we will not try to |
| 93 | // poll the socket again. Generally, return values below the MSS are worthless |
| 94 | // to try again. |
| 95 | #ifndef MIN_RET_FOR_READ_LOOP |
| 96 | #define MIN_RET_FOR_READ_LOOP 1460 |
| 97 | #endif |
| 98 | |
Willy Tarreau | 1db3771 | 2007-06-03 17:16:49 +0200 | [diff] [blame] | 99 | // the max number of events returned in one call to poll/epoll. Too small a |
| 100 | // value will cause lots of calls, and too high a value may cause high latency. |
| 101 | #ifndef MAX_POLL_EVENTS |
| 102 | #define MAX_POLL_EVENTS 200 |
| 103 | #endif |
| 104 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 105 | // cookie delimitor in "prefix" mode. This character is inserted between the |
| 106 | // persistence cookie and the original value. The '~' is allowed by RFC2965, |
| 107 | // and should not be too common in server names. |
| 108 | #ifndef COOKIE_DELIM |
| 109 | #define COOKIE_DELIM '~' |
| 110 | #endif |
| 111 | |
| 112 | #define CONN_RETRIES 3 |
| 113 | |
| 114 | #define CHK_CONNTIME 2000 |
| 115 | #define DEF_CHKINTR 2000 |
| 116 | #define DEF_FALLTIME 3 |
| 117 | #define DEF_RISETIME 2 |
| 118 | #define DEF_CHECK_REQ "OPTIONS / HTTP/1.0\r\n\r\n" |
Willy Tarreau | 2367790 | 2007-05-08 23:50:35 +0200 | [diff] [blame] | 119 | #define DEF_SMTP_CHECK_REQ "HELO localhost\r\n" |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 120 | |
Ross West | af72a1d | 2008-08-03 10:51:45 +0200 | [diff] [blame] | 121 | // X-Forwarded-For header default |
| 122 | #define DEF_XFORWARDFOR_HDR "X-Forwarded-For" |
| 123 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 124 | /* Default connections limit. |
| 125 | * |
| 126 | * A system limit can be enforced at build time in order to avoid using haproxy |
| 127 | * beyond reasonable system limits. For this, just define SYSTEM_MAXCONN to the |
| 128 | * absolute limit accepted by the system. If the configuration specifies a |
| 129 | * higher value, it will be capped to SYSTEM_MAXCONN and a warning will be |
| 130 | * emitted. The only way to override this limit will be to set it via the |
| 131 | * command-line '-n' argument. |
| 132 | */ |
| 133 | #ifndef SYSTEM_MAXCONN |
| 134 | #define DEFAULT_MAXCONN 2000 |
| 135 | #else |
| 136 | #define DEFAULT_MAXCONN SYSTEM_MAXCONN |
| 137 | #endif |
| 138 | |
Willy Tarreau | 2c43a1e | 2007-10-14 23:05:39 +0200 | [diff] [blame] | 139 | /* Minimum check interval for spread health checks. Servers with intervals |
| 140 | * greater than or equal to this value will have their checks spread apart |
| 141 | * and will be considered when searching the minimal interval. |
| 142 | * Others will be ignored for the minimal interval and will have their checks |
| 143 | * scheduled on a different basis. |
| 144 | */ |
| 145 | #ifndef SRV_CHK_INTER_THRES |
| 146 | #define SRV_CHK_INTER_THRES 1000 |
| 147 | #endif |
| 148 | |
Krzysztof Oledzki | d9db927 | 2007-10-15 10:05:11 +0200 | [diff] [blame] | 149 | /* Specifies the string used to report the version and release date on the |
| 150 | * statistics page. May be defined to the empty string ("") to permanently |
| 151 | * disable the feature. |
| 152 | */ |
| 153 | #ifndef STATS_VERSION_STRING |
| 154 | #define STATS_VERSION_STRING " version " HAPROXY_VERSION ", released " HAPROXY_DATE |
| 155 | #endif |
| 156 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 157 | #endif /* _COMMON_DEFAULTS_H */ |