Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | fd4bffe | 2020-05-27 14:38:20 +0200 | [diff] [blame] | 2 | * include/haproxy/defaults.h |
Willy Tarreau | deb9ed8 | 2010-01-03 21:03:22 +0100 | [diff] [blame] | 3 | * Miscellaneous default values. |
| 4 | * |
Willy Tarreau | fd4bffe | 2020-05-27 14:38:20 +0200 | [diff] [blame] | 5 | * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu |
Willy Tarreau | deb9ed8 | 2010-01-03 21:03:22 +0100 | [diff] [blame] | 6 | * |
| 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 | */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 21 | |
Willy Tarreau | fd4bffe | 2020-05-27 14:38:20 +0200 | [diff] [blame] | 22 | #ifndef _HAPROXY_DEFAULTS_H |
| 23 | #define _HAPROXY_DEFAULTS_H |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 24 | |
Willy Tarreau | ca8b069 | 2020-06-11 08:14:01 +0200 | [diff] [blame] | 25 | /* MAX_THREADS defines the highest limit for the global nbthread value. It |
| 26 | * defaults to the number of bits in a long integer when threads are enabled |
| 27 | * but may be lowered to save resources on embedded systems. |
| 28 | */ |
| 29 | #ifndef USE_THREAD |
Willy Tarreau | f966284 | 2021-09-13 18:11:26 +0200 | [diff] [blame] | 30 | /* threads disabled, 1 thread max, 1 group max (note: group ids start at 1) */ |
Willy Tarreau | ca8b069 | 2020-06-11 08:14:01 +0200 | [diff] [blame] | 31 | #define MAX_THREADS 1 |
Willy Tarreau | ca8b069 | 2020-06-11 08:14:01 +0200 | [diff] [blame] | 32 | |
Willy Tarreau | f966284 | 2021-09-13 18:11:26 +0200 | [diff] [blame] | 33 | #define MAX_TGROUPS 1 |
| 34 | #define MAX_THREADS_PER_GROUP 1 |
| 35 | |
Willy Tarreau | ca8b069 | 2020-06-11 08:14:01 +0200 | [diff] [blame] | 36 | #else |
Willy Tarreau | f966284 | 2021-09-13 18:11:26 +0200 | [diff] [blame] | 37 | |
Willy Tarreau | 856d56d | 2022-07-15 21:46:55 +0200 | [diff] [blame] | 38 | /* theoretical limit is 64, though we'd rather not push it too far for now |
| 39 | * as some structures might be enlarged to be indexed per group. Let's start |
| 40 | * with 16 groups max, allowing to experiment with dual-socket machines |
| 41 | * suffering from up to 8 loosely coupled L3 caches. It's a good start and |
| 42 | * doesn't engage us too far. |
| 43 | */ |
Willy Tarreau | f966284 | 2021-09-13 18:11:26 +0200 | [diff] [blame] | 44 | #ifndef MAX_TGROUPS |
Willy Tarreau | 856d56d | 2022-07-15 21:46:55 +0200 | [diff] [blame] | 45 | #define MAX_TGROUPS 16 |
Willy Tarreau | f966284 | 2021-09-13 18:11:26 +0200 | [diff] [blame] | 46 | #endif |
Willy Tarreau | 693688e | 2022-08-06 16:37:27 +0200 | [diff] [blame] | 47 | |
Willy Tarreau | f966284 | 2021-09-13 18:11:26 +0200 | [diff] [blame] | 48 | #define MAX_THREADS_PER_GROUP LONGBITS |
Willy Tarreau | 693688e | 2022-08-06 16:37:27 +0200 | [diff] [blame] | 49 | |
| 50 | /* threads enabled, max_threads defaults to long bits for 1 tgroup or 4 times |
| 51 | * long bits if more tgroups are enabled. |
| 52 | */ |
| 53 | #ifndef MAX_THREADS |
| 54 | #define MAX_THREADS ((((MAX_TGROUPS) > 1) ? 4 : 1) * (MAX_THREADS_PER_GROUP)) |
Willy Tarreau | ca8b069 | 2020-06-11 08:14:01 +0200 | [diff] [blame] | 55 | #endif |
| 56 | |
Willy Tarreau | 693688e | 2022-08-06 16:37:27 +0200 | [diff] [blame] | 57 | #endif // USE_THREAD |
| 58 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 59 | /* |
| 60 | * BUFSIZE defines the size of a read and write buffer. It is the maximum |
Willy Tarreau | 87b0966 | 2015-04-03 00:22:06 +0200 | [diff] [blame] | 61 | * amount of bytes which can be stored by the proxy for each stream. However, |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 62 | * when reading HTTP headers, the proxy needs some spare space to add or rewrite |
| 63 | * headers if needed. The size of this spare is defined with MAXREWRITE. So it |
| 64 | * is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By |
Willy Tarreau | 2709784 | 2015-09-28 13:53:23 +0200 | [diff] [blame] | 65 | * default, BUFSIZE=16384 bytes and MAXREWRITE=min(1024,BUFSIZE/2), so the |
| 66 | * maximum length of headers accepted is 15360 bytes. |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 67 | */ |
| 68 | #ifndef BUFSIZE |
| 69 | #define BUFSIZE 16384 |
| 70 | #endif |
| 71 | |
Willy Tarreau | a24adf0 | 2014-11-27 01:11:56 +0100 | [diff] [blame] | 72 | /* certain buffers may only be allocated for responses in order to avoid |
| 73 | * deadlocks caused by request queuing. 2 buffers is the absolute minimum |
| 74 | * acceptable to ensure that a request gaining access to a server can get |
| 75 | * a response buffer even if it doesn't completely flush the request buffer. |
| 76 | * The worst case is an applet making use of a request buffer that cannot |
| 77 | * completely be sent while the server starts to respond, and all unreserved |
| 78 | * buffers are allocated by request buffers from pending connections in the |
| 79 | * queue waiting for this one to flush. Both buffers reserved buffers may |
| 80 | * thus be used at the same time. |
| 81 | */ |
| 82 | #ifndef RESERVED_BUFS |
| 83 | #define RESERVED_BUFS 2 |
| 84 | #endif |
| 85 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 86 | // reserved buffer space for header rewriting |
| 87 | #ifndef MAXREWRITE |
Willy Tarreau | 2709784 | 2015-09-28 13:53:23 +0200 | [diff] [blame] | 88 | #define MAXREWRITE 1024 |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 89 | #endif |
| 90 | |
Willy Tarreau | bf43f6e | 2013-06-03 15:52:52 +0200 | [diff] [blame] | 91 | #ifndef REQURI_LEN |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 92 | #define REQURI_LEN 1024 |
Willy Tarreau | bf43f6e | 2013-06-03 15:52:52 +0200 | [diff] [blame] | 93 | #endif |
| 94 | |
| 95 | #ifndef CAPTURE_LEN |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 96 | #define CAPTURE_LEN 64 |
Willy Tarreau | bf43f6e | 2013-06-03 15:52:52 +0200 | [diff] [blame] | 97 | #endif |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 98 | |
Willy Tarreau | 4e95790 | 2014-06-27 18:08:49 +0200 | [diff] [blame] | 99 | #ifndef MAX_SYSLOG_LEN |
| 100 | #define MAX_SYSLOG_LEN 1024 |
| 101 | #endif |
| 102 | |
William Lallemand | eba6a54 | 2022-09-26 12:54:39 +0200 | [diff] [blame] | 103 | /* 64kB to archive startup-logs seems way more than enough |
| 104 | * /!\ Careful when changing this size, it is used in a shm when exec() from |
| 105 | * mworker to wait mode. |
| 106 | */ |
Willy Tarreau | aeed4a8 | 2020-06-04 22:01:04 +0200 | [diff] [blame] | 107 | #ifndef STARTUP_LOG_SIZE |
| 108 | #define STARTUP_LOG_SIZE 65536 |
| 109 | #endif |
| 110 | |
Krzysztof Piotr Oledzki | e6bbd74 | 2007-11-01 00:33:12 +0100 | [diff] [blame] | 111 | // maximum line size when parsing config |
| 112 | #ifndef LINESIZE |
| 113 | #define LINESIZE 2048 |
| 114 | #endif |
| 115 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 116 | // max # args on a configuration line |
Krzysztof Piotr Oledzki | e6bbd74 | 2007-11-01 00:33:12 +0100 | [diff] [blame] | 117 | #define MAX_LINE_ARGS 64 |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 118 | |
Emmanuel Hocdet | 9826329 | 2016-12-29 18:26:15 +0100 | [diff] [blame] | 119 | // maximum line size when parsing crt-bind-list config |
| 120 | #define CRT_LINESIZE 65536 |
| 121 | |
| 122 | // max # args on crt-bind-list configuration line |
| 123 | #define MAX_CRT_ARGS 2048 |
Emmanuel Hocdet | 5e0e6e4 | 2016-05-13 11:18:50 +0200 | [diff] [blame] | 124 | |
Willy Tarreau | f14c757 | 2021-03-13 10:59:23 +0100 | [diff] [blame] | 125 | // max # args on a command issued on the CLI ("stats socket") |
Willy Tarreau | 47060b6 | 2013-08-01 21:11:42 +0200 | [diff] [blame] | 126 | // This should cover at least 5 + twice the # of data_types |
Willy Tarreau | f14c757 | 2021-03-13 10:59:23 +0100 | [diff] [blame] | 127 | #define MAX_CLI_ARGS 64 |
Krzysztof Piotr Oledzki | 2c6962c | 2008-03-02 02:42:14 +0100 | [diff] [blame] | 128 | |
Willy Tarreau | dc70c18 | 2021-07-20 17:58:34 +0200 | [diff] [blame] | 129 | // max recursion levels in config condition evaluations |
| 130 | // (note that binary operators add one recursion level, and |
| 131 | // that parenthesis may add two). |
| 132 | #define MAX_CFG_RECURSION 1024 |
| 133 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 134 | // max # of matches per regexp |
| 135 | #define MAX_MATCH 10 |
| 136 | |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 137 | // max # of headers in one HTTP request or response |
Willy Tarreau | ac1932d | 2011-10-24 19:14:41 +0200 | [diff] [blame] | 138 | // By default, about 100 headers (+1 for the first line) |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 139 | #ifndef MAX_HTTP_HDR |
Willy Tarreau | ac1932d | 2011-10-24 19:14:41 +0200 | [diff] [blame] | 140 | #define MAX_HTTP_HDR 101 |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 141 | #endif |
| 142 | |
Willy Tarreau | bce7088 | 2009-09-07 11:51:47 +0200 | [diff] [blame] | 143 | // max # of headers in history when looking for header #-X |
| 144 | #ifndef MAX_HDR_HISTORY |
| 145 | #define MAX_HDR_HISTORY 10 |
| 146 | #endif |
| 147 | |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 148 | // max # of stick counters per session (at least 3 for sc0..sc2) |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 149 | #ifndef MAX_SESS_STKCTR |
| 150 | #define MAX_SESS_STKCTR 3 |
| 151 | #endif |
| 152 | |
Ilya Shipitsin | 77e3b4a | 2020-03-10 12:06:11 +0500 | [diff] [blame] | 153 | // max # of extra stick-table data types that can be registered at runtime |
Willy Tarreau | edee1d6 | 2014-07-15 16:44:27 +0200 | [diff] [blame] | 154 | #ifndef STKTABLE_EXTRA_DATA_TYPES |
| 155 | #define STKTABLE_EXTRA_DATA_TYPES 0 |
| 156 | #endif |
| 157 | |
Adis Nezirovic | 1a693fc | 2020-01-16 15:19:29 +0100 | [diff] [blame] | 158 | // max # of stick-table filter entries that can be used during dump |
| 159 | #ifndef STKTABLE_FILTER_LEN |
| 160 | #define STKTABLE_FILTER_LEN 4 |
| 161 | #endif |
| 162 | |
Willy Tarreau | b8949f1 | 2007-03-23 22:39:59 +0100 | [diff] [blame] | 163 | // max # of loops we can perform around a read() which succeeds. |
| 164 | // It's very frequent that the system returns a few TCP segments at a time. |
| 165 | #ifndef MAX_READ_POLL_LOOPS |
| 166 | #define MAX_READ_POLL_LOOPS 4 |
| 167 | #endif |
| 168 | |
Willy Tarreau | 6f4a82c | 2009-03-21 20:43:57 +0100 | [diff] [blame] | 169 | // minimum number of bytes read at once above which we don't try to read |
| 170 | // more, in order not to risk facing an EAGAIN. Most often, if we read |
| 171 | // at least 10 kB, we can consider that the system has tried to read a |
| 172 | // full buffer and got multiple segments (>1 MSS for jumbo frames, >7 MSS |
| 173 | // for normal frames) did not bother truncating the last segment. |
| 174 | #ifndef MIN_RECV_AT_ONCE_ENOUGH |
| 175 | #define MIN_RECV_AT_ONCE_ENOUGH (7*1448) |
| 176 | #endif |
| 177 | |
Willy Tarreau | 14acc70 | 2011-05-11 20:47:24 +0200 | [diff] [blame] | 178 | // The minimum number of bytes to be forwarded that is worth trying to splice. |
| 179 | // Below 4kB, it's not worth allocating pipes nor pretending to zero-copy. |
| 180 | #ifndef MIN_SPLICE_FORWARD |
| 181 | #define MIN_SPLICE_FORWARD 4096 |
| 182 | #endif |
| 183 | |
Willy Tarreau | 1db3771 | 2007-06-03 17:16:49 +0200 | [diff] [blame] | 184 | // the max number of events returned in one call to poll/epoll. Too small a |
| 185 | // value will cause lots of calls, and too high a value may cause high latency. |
| 186 | #ifndef MAX_POLL_EVENTS |
| 187 | #define MAX_POLL_EVENTS 200 |
| 188 | #endif |
| 189 | |
Willy Tarreau | 561958c | 2021-10-06 19:36:47 +0200 | [diff] [blame] | 190 | /* eternity when exprimed in timeval */ |
| 191 | #ifndef TV_ETERNITY |
| 192 | #define TV_ETERNITY (~0UL) |
| 193 | #endif |
| 194 | |
| 195 | /* eternity when exprimed in ms */ |
| 196 | #ifndef TV_ETERNITY_MS |
| 197 | #define TV_ETERNITY_MS (-1) |
| 198 | #endif |
| 199 | |
| 200 | /* we want to be able to detect time jumps. Fix the maximum wait time to a low |
| 201 | * value so that we know the time has changed if we wait longer. |
| 202 | */ |
| 203 | #ifndef MAX_DELAY_MS |
| 204 | #define MAX_DELAY_MS 60000 |
| 205 | #endif |
| 206 | |
Willy Tarreau | 6616132 | 2021-02-19 15:50:27 +0100 | [diff] [blame] | 207 | // The maximum number of connections accepted at once by a thread for a single |
| 208 | // listener. It used to default to 64 divided by the number of processes but |
| 209 | // the tasklet-based model is much more scalable and benefits from smaller |
| 210 | // values. Experimentation has shown that 4 gives the highest accept rate for |
| 211 | // all thread values, and that 3 and 5 come very close, as shown below (HTTP/1 |
| 212 | // connections forwarded per second at multi-accept 4 and 64): |
| 213 | // |
| 214 | // ac\thr| 1 2 4 8 16 |
| 215 | // ------+------------------------------ |
| 216 | // 4| 80k 106k 168k 270k 336k |
| 217 | // 64| 63k 89k 145k 230k 274k |
| 218 | // |
| 219 | #ifndef MAX_ACCEPT |
| 220 | #define MAX_ACCEPT 4 |
| 221 | #endif |
| 222 | |
Willy Tarreau | 060a761 | 2021-03-10 11:06:26 +0100 | [diff] [blame] | 223 | // The base max number of tasks to run at once to be used when not set by |
| 224 | // tune.runqueue-depth. It will automatically be divided by the square root |
| 225 | // of the number of threads for better fairness. As such, 64 threads will |
| 226 | // use 35 and a single thread will use 280. |
Olivier Houchard | 1599b80 | 2018-05-24 18:59:04 +0200 | [diff] [blame] | 227 | #ifndef RUNQUEUE_DEPTH |
Willy Tarreau | 060a761 | 2021-03-10 11:06:26 +0100 | [diff] [blame] | 228 | #define RUNQUEUE_DEPTH 280 |
Olivier Houchard | 1599b80 | 2018-05-24 18:59:04 +0200 | [diff] [blame] | 229 | #endif |
| 230 | |
Ilya Shipitsin | 77e3b4a | 2020-03-10 12:06:11 +0500 | [diff] [blame] | 231 | // cookie delimiter in "prefix" mode. This character is inserted between the |
Lukas Tribus | 2395368 | 2017-04-28 13:24:30 +0000 | [diff] [blame] | 232 | // persistence cookie and the original value. The '~' is allowed by RFC6265, |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 233 | // and should not be too common in server names. |
| 234 | #ifndef COOKIE_DELIM |
| 235 | #define COOKIE_DELIM '~' |
| 236 | #endif |
| 237 | |
Ilya Shipitsin | 77e3b4a | 2020-03-10 12:06:11 +0500 | [diff] [blame] | 238 | // this delimiter is used between a server's name and a last visit date in |
Willy Tarreau | bca9969 | 2010-10-06 19:25:55 +0200 | [diff] [blame] | 239 | // cookies exchanged with the client. |
| 240 | #ifndef COOKIE_DELIM_DATE |
| 241 | #define COOKIE_DELIM_DATE '|' |
| 242 | #endif |
| 243 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 244 | #define CONN_RETRIES 3 |
| 245 | |
| 246 | #define CHK_CONNTIME 2000 |
| 247 | #define DEF_CHKINTR 2000 |
Pieter Baauw | 46af170 | 2016-02-12 14:35:20 +0100 | [diff] [blame] | 248 | #define DEF_MAILALERTTIME 10000 |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 249 | #define DEF_FALLTIME 3 |
| 250 | #define DEF_RISETIME 2 |
Simon Horman | 58c3297 | 2013-11-25 10:46:38 +0900 | [diff] [blame] | 251 | #define DEF_AGENT_FALLTIME 1 |
| 252 | #define DEF_AGENT_RISETIME 1 |
Simon Horman | 98637e5 | 2014-06-20 12:30:16 +0900 | [diff] [blame] | 253 | #define DEF_CHECK_PATH "" |
Christopher Faulet | 33f05df | 2020-04-01 11:08:50 +0200 | [diff] [blame] | 254 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 255 | |
Krzysztof Piotr Oledzki | 97f07b8 | 2009-12-15 22:31:24 +0100 | [diff] [blame] | 256 | #define DEF_HANA_ONERR HANA_ONERR_FAILCHK |
| 257 | #define DEF_HANA_ERRLIMIT 10 |
| 258 | |
Ross West | af72a1d | 2008-08-03 10:51:45 +0200 | [diff] [blame] | 259 | // X-Forwarded-For header default |
| 260 | #define DEF_XFORWARDFOR_HDR "X-Forwarded-For" |
| 261 | |
Maik Broemme | 2850cb4 | 2009-04-17 18:53:21 +0200 | [diff] [blame] | 262 | // X-Original-To header default |
| 263 | #define DEF_XORIGINALTO_HDR "X-Original-To" |
| 264 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 265 | /* Default connections limit. |
| 266 | * |
| 267 | * A system limit can be enforced at build time in order to avoid using haproxy |
| 268 | * beyond reasonable system limits. For this, just define SYSTEM_MAXCONN to the |
| 269 | * absolute limit accepted by the system. If the configuration specifies a |
| 270 | * higher value, it will be capped to SYSTEM_MAXCONN and a warning will be |
| 271 | * emitted. The only way to override this limit will be to set it via the |
Willy Tarreau | df23c0c | 2019-03-13 10:10:49 +0100 | [diff] [blame] | 272 | * command-line '-n' argument. If SYSTEM_MAXCONN is not set, a minimum value |
| 273 | * of 100 will be used for DEFAULT_MAXCONN which almost guarantees that a |
| 274 | * process will correctly start in any situation. |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 275 | */ |
Willy Tarreau | ca783d4 | 2019-03-13 10:03:07 +0100 | [diff] [blame] | 276 | #ifdef SYSTEM_MAXCONN |
Willy Tarreau | c9fe456 | 2009-06-15 16:33:36 +0200 | [diff] [blame] | 277 | #undef DEFAULT_MAXCONN |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 278 | #define DEFAULT_MAXCONN SYSTEM_MAXCONN |
Willy Tarreau | df23c0c | 2019-03-13 10:10:49 +0100 | [diff] [blame] | 279 | #elif !defined(DEFAULT_MAXCONN) |
| 280 | #define DEFAULT_MAXCONN 100 |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 281 | #endif |
| 282 | |
Willy Tarreau | 2c43a1e | 2007-10-14 23:05:39 +0200 | [diff] [blame] | 283 | /* Minimum check interval for spread health checks. Servers with intervals |
| 284 | * greater than or equal to this value will have their checks spread apart |
| 285 | * and will be considered when searching the minimal interval. |
| 286 | * Others will be ignored for the minimal interval and will have their checks |
| 287 | * scheduled on a different basis. |
| 288 | */ |
| 289 | #ifndef SRV_CHK_INTER_THRES |
| 290 | #define SRV_CHK_INTER_THRES 1000 |
| 291 | #endif |
| 292 | |
Krzysztof Oledzki | d9db927 | 2007-10-15 10:05:11 +0200 | [diff] [blame] | 293 | /* Specifies the string used to report the version and release date on the |
| 294 | * statistics page. May be defined to the empty string ("") to permanently |
| 295 | * disable the feature. |
| 296 | */ |
| 297 | #ifndef STATS_VERSION_STRING |
| 298 | #define STATS_VERSION_STRING " version " HAPROXY_VERSION ", released " HAPROXY_DATE |
| 299 | #endif |
| 300 | |
Willy Tarreau | ac13aea | 2020-06-04 10:36:03 +0200 | [diff] [blame] | 301 | /* This is the default statistics URI */ |
| 302 | #ifdef CONFIG_STATS_DEFAULT_URI |
| 303 | #define STATS_DEFAULT_URI CONFIG_STATS_DEFAULT_URI |
| 304 | #else |
| 305 | #define STATS_DEFAULT_URI "/haproxy?stats" |
| 306 | #endif |
| 307 | |
| 308 | /* This is the default statistics realm */ |
| 309 | #ifdef CONFIG_STATS_DEFAULT_REALM |
| 310 | #define STATS_DEFAULT_REALM CONFIG_STATS_DEFAULT_REALM |
| 311 | #else |
| 312 | #define STATS_DEFAULT_REALM "HAProxy Statistics" |
| 313 | #endif |
| 314 | |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 315 | /* Maximum signal queue size, and also number of different signals we can |
| 316 | * handle. |
| 317 | */ |
| 318 | #ifndef MAX_SIGNAL |
| 319 | #define MAX_SIGNAL 256 |
| 320 | #endif |
| 321 | |
Willy Tarreau | 3ad6a76 | 2009-08-16 10:08:02 +0200 | [diff] [blame] | 322 | /* Maximum host name length */ |
| 323 | #ifndef MAX_HOSTNAME_LEN |
Willy Tarreau | 3305643 | 2021-08-28 12:05:32 +0200 | [diff] [blame] | 324 | #ifdef MAXHOSTNAMELEN |
Willy Tarreau | 75abcb3 | 2015-01-14 11:48:58 +0100 | [diff] [blame] | 325 | #define MAX_HOSTNAME_LEN MAXHOSTNAMELEN |
| 326 | #else |
| 327 | #define MAX_HOSTNAME_LEN 64 |
| 328 | #endif // MAXHOSTNAMELEN |
| 329 | #endif // MAX_HOSTNAME_LEN |
Willy Tarreau | 3ad6a76 | 2009-08-16 10:08:02 +0200 | [diff] [blame] | 330 | |
Krzysztof Piotr Oledzki | f7089f5 | 2009-10-10 21:06:49 +0200 | [diff] [blame] | 331 | /* Maximum health check description length */ |
| 332 | #ifndef HCHK_DESC_LEN |
| 333 | #define HCHK_DESC_LEN 128 |
| 334 | #endif |
| 335 | |
Emeric Brun | 76d8895 | 2012-10-05 15:47:31 +0200 | [diff] [blame] | 336 | /* ciphers used as defaults on connect */ |
| 337 | #ifndef CONNECT_DEFAULT_CIPHERS |
| 338 | #define CONNECT_DEFAULT_CIPHERS NULL |
| 339 | #endif |
| 340 | |
Dirkjan Bussink | 415150f | 2018-09-14 11:14:21 +0200 | [diff] [blame] | 341 | /* ciphers used as defaults on TLS 1.3 connect */ |
| 342 | #ifndef CONNECT_DEFAULT_CIPHERSUITES |
| 343 | #define CONNECT_DEFAULT_CIPHERSUITES NULL |
| 344 | #endif |
| 345 | |
Emeric Brun | 76d8895 | 2012-10-05 15:47:31 +0200 | [diff] [blame] | 346 | /* ciphers used as defaults on listeners */ |
| 347 | #ifndef LISTEN_DEFAULT_CIPHERS |
| 348 | #define LISTEN_DEFAULT_CIPHERS NULL |
| 349 | #endif |
| 350 | |
Dirkjan Bussink | 415150f | 2018-09-14 11:14:21 +0200 | [diff] [blame] | 351 | /* cipher suites used as defaults on TLS 1.3 listeners */ |
| 352 | #ifndef LISTEN_DEFAULT_CIPHERSUITES |
| 353 | #define LISTEN_DEFAULT_CIPHERSUITES NULL |
| 354 | #endif |
| 355 | |
Emeric Brun | 6924ef8 | 2013-03-06 14:08:53 +0100 | [diff] [blame] | 356 | /* named curve used as defaults for ECDHE ciphers */ |
| 357 | #ifndef ECDHE_DEFAULT_CURVE |
| 358 | #define ECDHE_DEFAULT_CURVE "prime256v1" |
| 359 | #endif |
| 360 | |
Emeric Brun | 4663577 | 2012-11-14 11:32:56 +0100 | [diff] [blame] | 361 | /* ssl cache size */ |
| 362 | #ifndef SSLCACHESIZE |
| 363 | #define SSLCACHESIZE 20000 |
| 364 | #endif |
| 365 | |
Remi Gacogne | f46cd6e | 2014-06-12 14:58:40 +0200 | [diff] [blame] | 366 | /* ssl max dh param size */ |
| 367 | #ifndef SSL_DEFAULT_DH_PARAM |
Remi Tricot-Le Breton | 1d6338e | 2022-04-12 11:31:55 +0200 | [diff] [blame] | 368 | #define SSL_DEFAULT_DH_PARAM 0 |
Remi Gacogne | f46cd6e | 2014-06-12 14:58:40 +0200 | [diff] [blame] | 369 | #endif |
| 370 | |
Willy Tarreau | d92aa5c | 2015-01-15 21:34:39 +0100 | [diff] [blame] | 371 | /* max memory cost per SSL session */ |
| 372 | #ifndef SSL_SESSION_MAX_COST |
| 373 | #define SSL_SESSION_MAX_COST (16*1024) // measured |
| 374 | #endif |
| 375 | |
| 376 | /* max memory cost per SSL handshake (on top of session) */ |
| 377 | #ifndef SSL_HANDSHAKE_MAX_COST |
| 378 | #define SSL_HANDSHAKE_MAX_COST (76*1024) // measured |
| 379 | #endif |
Willy Tarreau | d025648 | 2015-01-15 21:45:22 +0100 | [diff] [blame] | 380 | |
Christopher Faulet | 31af49d | 2015-06-09 17:29:50 +0200 | [diff] [blame] | 381 | #ifndef DEFAULT_SSL_CTX_CACHE |
| 382 | #define DEFAULT_SSL_CTX_CACHE 1000 |
| 383 | #endif |
| 384 | |
Willy Tarreau | 87b0966 | 2015-04-03 00:22:06 +0200 | [diff] [blame] | 385 | /* approximate stream size (for maxconn estimate) */ |
| 386 | #ifndef STREAM_MAX_COST |
| 387 | #define STREAM_MAX_COST (sizeof(struct stream) + \ |
Willy Tarreau | d025648 | 2015-01-15 21:45:22 +0100 | [diff] [blame] | 388 | 2 * sizeof(struct channel) + \ |
| 389 | 2 * sizeof(struct connection) + \ |
Stéphane Cottin | 23e9e93 | 2017-05-18 08:58:41 +0200 | [diff] [blame] | 390 | global.tune.requri_len + \ |
Willy Tarreau | d025648 | 2015-01-15 21:45:22 +0100 | [diff] [blame] | 391 | 2 * global.tune.cookie_len) |
| 392 | #endif |
| 393 | |
| 394 | /* available memory estimate : count about 3% of overhead in various structures */ |
| 395 | #ifndef MEM_USABLE_RATIO |
| 396 | #define MEM_USABLE_RATIO 0.97 |
Willy Tarreau | d92aa5c | 2015-01-15 21:34:39 +0100 | [diff] [blame] | 397 | #endif |
| 398 | |
Willy Tarreau | b61fccd | 2022-02-17 17:15:02 +0100 | [diff] [blame] | 399 | /* if not 0, maximum allocatable memory per process in MB */ |
| 400 | #ifndef HAPROXY_MEMMAX |
| 401 | #define HAPROXY_MEMMAX 0 |
| 402 | #endif |
| 403 | |
Willy Tarreau | 197715a | 2022-04-25 19:29:10 +0200 | [diff] [blame] | 404 | /* For USE_ZLIB, DEFAULT_MAXZLIBMEM may be set to a hard-coded value that will |
| 405 | * preset a maxzlibmem value. Just leave it to zero for other configurations. |
| 406 | * Note that it's expressed in megabytes. |
| 407 | */ |
| 408 | #if !defined(DEFAULT_MAXZLIBMEM) || !defined(USE_ZLIB) |
| 409 | #undef DEFAULT_MAXZLIBMEM |
| 410 | #define DEFAULT_MAXZLIBMEM 0 |
| 411 | #endif |
| 412 | |
Willy Tarreau | 8de6dc9 | 2021-09-27 19:29:30 +0200 | [diff] [blame] | 413 | /* On modern architectures with many threads, a fast memory allocator, and |
| 414 | * local pools, the global pools with their single list can be way slower than |
| 415 | * the standard allocator which already has its own per-thread arenas. In this |
| 416 | * case we disable global pools. The global pools may still be enforced |
| 417 | * using CONFIG_HAP_GLOBAL_POOLS though. |
| 418 | */ |
| 419 | #if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && !defined(CONFIG_HAP_GLOBAL_POOLS) |
| 420 | #define CONFIG_HAP_NO_GLOBAL_POOLS |
| 421 | #endif |
| 422 | |
Willy Tarreau | 3bc4e8b | 2020-05-09 09:02:35 +0200 | [diff] [blame] | 423 | /* default per-thread pool cache size when enabled */ |
| 424 | #ifndef CONFIG_HAP_POOL_CACHE_SIZE |
Willy Tarreau | f5e94b2 | 2022-01-02 19:38:54 +0100 | [diff] [blame] | 425 | #define CONFIG_HAP_POOL_CACHE_SIZE 524288 |
Willy Tarreau | 3bc4e8b | 2020-05-09 09:02:35 +0200 | [diff] [blame] | 426 | #endif |
| 427 | |
Willy Tarreau | 43937e9 | 2022-01-02 17:24:55 +0100 | [diff] [blame] | 428 | #ifndef CONFIG_HAP_POOL_CLUSTER_SIZE |
| 429 | #define CONFIG_HAP_POOL_CLUSTER_SIZE 8 |
| 430 | #endif |
| 431 | |
Willy Tarreau | 4bfc580 | 2014-06-17 12:19:18 +0200 | [diff] [blame] | 432 | /* Number of samples used to compute the times reported in stats. A power of |
| 433 | * two is highly recommended, and this value multiplied by the largest response |
| 434 | * time must not overflow and unsigned int. See freq_ctr.h for more information. |
| 435 | * We consider that values are accurate to 95% with two batches of samples below, |
| 436 | * so in order to advertise accurate times across 1k samples, we effectively |
| 437 | * measure over 512. |
| 438 | */ |
| 439 | #ifndef TIME_STATS_SAMPLES |
| 440 | #define TIME_STATS_SAMPLES 512 |
| 441 | #endif |
| 442 | |
Emeric Brun | 4147b2e | 2014-06-16 18:36:30 +0200 | [diff] [blame] | 443 | /* max ocsp cert id asn1 encoded length */ |
| 444 | #ifndef OCSP_MAX_CERTID_ASN1_LENGTH |
| 445 | #define OCSP_MAX_CERTID_ASN1_LENGTH 128 |
| 446 | #endif |
| 447 | |
Emeric Brun | c8b27b6 | 2014-06-19 14:16:17 +0200 | [diff] [blame] | 448 | #ifndef OCSP_MAX_RESPONSE_TIME_SKEW |
| 449 | #define OCSP_MAX_RESPONSE_TIME_SKEW 300 |
| 450 | #endif |
Nenad Merdanovic | 05552d4 | 2015-02-27 19:56:49 +0100 | [diff] [blame] | 451 | |
| 452 | /* Number of TLS tickets to check, used for rotation */ |
| 453 | #ifndef TLS_TICKETS_NO |
| 454 | #define TLS_TICKETS_NO 3 |
| 455 | #endif |
Willy Tarreau | f3045d2 | 2015-04-29 16:24:50 +0200 | [diff] [blame] | 456 | |
| 457 | /* pattern lookup default cache size, in number of entries : |
| 458 | * 10k entries at 10k req/s mean 1% risk of a collision after 60 years, that's |
| 459 | * already much less than the memory's reliability in most machines and more |
| 460 | * durable than most admin's life expectancy. A collision will result in a |
| 461 | * valid result to be returned for a different entry from the same list. |
| 462 | */ |
| 463 | #ifndef DEFAULT_PAT_LRU_SIZE |
| 464 | #define DEFAULT_PAT_LRU_SIZE 10000 |
| 465 | #endif |
| 466 | |
Willy Tarreau | 0f6ffd6 | 2020-06-03 19:33:00 +0200 | [diff] [blame] | 467 | /* maximum number of pollers that may be registered */ |
| 468 | #ifndef MAX_POLLERS |
| 469 | #define MAX_POLLERS 10 |
| 470 | #endif |
| 471 | |
Amaury Denoyelle | b56a7c8 | 2021-03-26 18:20:47 +0100 | [diff] [blame] | 472 | /* system sysfs directory */ |
| 473 | #define NUMA_DETECT_SYSTEM_SYSFS_PATH "/sys/devices/system" |
| 474 | |
Willy Tarreau | fd4bffe | 2020-05-27 14:38:20 +0200 | [diff] [blame] | 475 | #endif /* _HAPROXY_DEFAULTS_H */ |