2006-06-26 00:48:02 +00:00
|
|
|
/*
|
2010-01-03 20:03:22 +00:00
|
|
|
* include/common/defaults.h
|
|
|
|
* Miscellaneous default values.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
|
|
* exclusively.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#ifndef _COMMON_DEFAULTS_H
|
|
|
|
#define _COMMON_DEFAULTS_H
|
2006-06-26 00:48:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* BUFSIZE defines the size of a read and write buffer. It is the maximum
|
|
|
|
* amount of bytes which can be stored by the proxy for each session. However,
|
|
|
|
* when reading HTTP headers, the proxy needs some spare space to add or rewrite
|
|
|
|
* headers if needed. The size of this spare is defined with MAXREWRITE. So it
|
|
|
|
* is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By
|
|
|
|
* default, BUFSIZE=16384 bytes and MAXREWRITE=BUFSIZE/2, so the maximum length
|
|
|
|
* of headers accepted is 8192 bytes, which is in line with Apache's limits.
|
|
|
|
*/
|
|
|
|
#ifndef BUFSIZE
|
|
|
|
#define BUFSIZE 16384
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// reserved buffer space for header rewriting
|
|
|
|
#ifndef MAXREWRITE
|
|
|
|
#define MAXREWRITE (BUFSIZE / 2)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define REQURI_LEN 1024
|
|
|
|
#define CAPTURE_LEN 64
|
|
|
|
|
2007-10-31 23:33:12 +00:00
|
|
|
// maximum line size when parsing config
|
|
|
|
#ifndef LINESIZE
|
|
|
|
#define LINESIZE 2048
|
|
|
|
#endif
|
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
// max # args on a configuration line
|
2007-10-31 23:33:12 +00:00
|
|
|
#define MAX_LINE_ARGS 64
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2009-08-16 17:06:42 +00:00
|
|
|
// max # args on a stats socket
|
|
|
|
#define MAX_STATS_ARGS 16
|
[MAJOR] proto_uxst rework -> SNMP support
Currently there is a ~16KB limit for a data size passed via unix socket.
It is caused by a trivial bug ttat is going to fixed soon, however
in most cases there is no need to dump a full stats.
This patch makes possible to select a scope of dumped data by extending
current "show stat" to "show stat [<iid> <type> <sid>]":
- iid is a proxy id, -1 to dump all proxies
- type selects type of dumpable objects: 1 for frontend, 2 for backend, 4 for
server, -1 for all types. Values can be ORed, for example:
1+2=3 -> frontend+backend.
1+2+4=7 -> frontend+backend+server.
- sid is a service id, -1 to dump everything from the selected proxy.
To do this I implemented a new session flag (SN_STAT_BOUND), added three
variables in data_ctx.stats (iid, type, sid), modified dumpstats.c and
completely revorked the process_uxst_stats: now it waits for a "\n"
terminated string, splits args and uses them. BTW: It should be quite easy
to add new commands, for example to enable/disable servers, the only problem
I can see is a not very lucky config name (*stats* socket). :|
During the work I also fixed two bug:
- s->flags were not initialized for proto_uxst
- missing comma if throttling not enabled (caused by a stupid change in
"Implement persistent id for proxies and servers")
Other changes:
- No more magic type valuse, use STATS_TYPE_FE/STATS_TYPE_BE/STATS_TYPE_SV
- Don't memset full s->data_ctx (it was clearing s->data_ctx.stats.{iid/type/sid},
instead initialize stats.sv & stats.sv_st (stats.px and stats.px_st were already
initialized)
With all that changes it was extremely easy to write a short perl plugin
for a perl-enabled net-snmp (also included in this patch).
29385 is my PEN (Private Enterprise Number) and I'm willing to donate
the SNMPv2-SMI::enterprises.29385.106.* OIDs for HAProxy if there
is nothing assigned already.
2008-03-02 01:42:14 +00:00
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
// max # of matches per regexp
|
|
|
|
#define MAX_MATCH 10
|
|
|
|
|
2006-12-03 14:21:35 +00:00
|
|
|
// max # of headers in one HTTP request or response
|
|
|
|
// By default, about 100 headers per 8 kB.
|
|
|
|
#ifndef MAX_HTTP_HDR
|
|
|
|
#define MAX_HTTP_HDR ((BUFSIZE+79)/80)
|
|
|
|
#endif
|
|
|
|
|
2007-03-23 21:39:59 +00:00
|
|
|
// max # of loops we can perform around a read() which succeeds.
|
|
|
|
// It's very frequent that the system returns a few TCP segments at a time.
|
|
|
|
#ifndef MAX_READ_POLL_LOOPS
|
|
|
|
#define MAX_READ_POLL_LOOPS 4
|
|
|
|
#endif
|
|
|
|
|
2009-03-21 19:43:57 +00:00
|
|
|
// minimum number of bytes read at once above which we don't try to read
|
|
|
|
// more, in order not to risk facing an EAGAIN. Most often, if we read
|
|
|
|
// at least 10 kB, we can consider that the system has tried to read a
|
|
|
|
// full buffer and got multiple segments (>1 MSS for jumbo frames, >7 MSS
|
|
|
|
// for normal frames) did not bother truncating the last segment.
|
|
|
|
#ifndef MIN_RECV_AT_ONCE_ENOUGH
|
|
|
|
#define MIN_RECV_AT_ONCE_ENOUGH (7*1448)
|
|
|
|
#endif
|
|
|
|
|
2007-04-15 18:56:27 +00:00
|
|
|
// same, but for writes. Generally, it's enough to write twice: one time for
|
|
|
|
// first half of the buffer, and a second time for the last half after a
|
|
|
|
// wrap-around.
|
|
|
|
#ifndef MAX_WRITE_POLL_LOOPS
|
|
|
|
#define MAX_WRITE_POLL_LOOPS 2
|
|
|
|
#endif
|
|
|
|
|
2007-03-23 22:02:09 +00:00
|
|
|
// the number of bytes returned by a read below which we will not try to
|
|
|
|
// poll the socket again. Generally, return values below the MSS are worthless
|
|
|
|
// to try again.
|
|
|
|
#ifndef MIN_RET_FOR_READ_LOOP
|
|
|
|
#define MIN_RET_FOR_READ_LOOP 1460
|
|
|
|
#endif
|
|
|
|
|
2007-06-03 15:16:49 +00:00
|
|
|
// the max number of events returned in one call to poll/epoll. Too small a
|
|
|
|
// value will cause lots of calls, and too high a value may cause high latency.
|
|
|
|
#ifndef MAX_POLL_EVENTS
|
|
|
|
#define MAX_POLL_EVENTS 200
|
|
|
|
#endif
|
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
// cookie delimitor in "prefix" mode. This character is inserted between the
|
|
|
|
// persistence cookie and the original value. The '~' is allowed by RFC2965,
|
|
|
|
// and should not be too common in server names.
|
|
|
|
#ifndef COOKIE_DELIM
|
|
|
|
#define COOKIE_DELIM '~'
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CONN_RETRIES 3
|
|
|
|
|
|
|
|
#define CHK_CONNTIME 2000
|
|
|
|
#define DEF_CHKINTR 2000
|
|
|
|
#define DEF_FALLTIME 3
|
|
|
|
#define DEF_RISETIME 2
|
2010-01-27 10:28:42 +00:00
|
|
|
#define DEF_CHECK_REQ "OPTIONS / HTTP/1.0\r\n"
|
2007-05-08 21:50:35 +00:00
|
|
|
#define DEF_SMTP_CHECK_REQ "HELO localhost\r\n"
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2009-12-15 21:31:24 +00:00
|
|
|
#define DEF_HANA_ONERR HANA_ONERR_FAILCHK
|
|
|
|
#define DEF_HANA_ERRLIMIT 10
|
|
|
|
|
2008-08-03 08:51:45 +00:00
|
|
|
// X-Forwarded-For header default
|
|
|
|
#define DEF_XFORWARDFOR_HDR "X-Forwarded-For"
|
|
|
|
|
2009-04-17 16:53:21 +00:00
|
|
|
// X-Original-To header default
|
|
|
|
#define DEF_XORIGINALTO_HDR "X-Original-To"
|
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
/* Default connections limit.
|
|
|
|
*
|
|
|
|
* A system limit can be enforced at build time in order to avoid using haproxy
|
|
|
|
* beyond reasonable system limits. For this, just define SYSTEM_MAXCONN to the
|
|
|
|
* absolute limit accepted by the system. If the configuration specifies a
|
|
|
|
* higher value, it will be capped to SYSTEM_MAXCONN and a warning will be
|
|
|
|
* emitted. The only way to override this limit will be to set it via the
|
|
|
|
* command-line '-n' argument.
|
|
|
|
*/
|
|
|
|
#ifndef SYSTEM_MAXCONN
|
2009-06-15 14:33:36 +00:00
|
|
|
#ifndef DEFAULT_MAXCONN
|
2006-06-26 00:48:02 +00:00
|
|
|
#define DEFAULT_MAXCONN 2000
|
2009-06-15 14:33:36 +00:00
|
|
|
#endif
|
2006-06-26 00:48:02 +00:00
|
|
|
#else
|
2009-06-15 14:33:36 +00:00
|
|
|
#undef DEFAULT_MAXCONN
|
2006-06-26 00:48:02 +00:00
|
|
|
#define DEFAULT_MAXCONN SYSTEM_MAXCONN
|
|
|
|
#endif
|
|
|
|
|
2007-10-14 21:05:39 +00:00
|
|
|
/* Minimum check interval for spread health checks. Servers with intervals
|
|
|
|
* greater than or equal to this value will have their checks spread apart
|
|
|
|
* and will be considered when searching the minimal interval.
|
|
|
|
* Others will be ignored for the minimal interval and will have their checks
|
|
|
|
* scheduled on a different basis.
|
|
|
|
*/
|
|
|
|
#ifndef SRV_CHK_INTER_THRES
|
|
|
|
#define SRV_CHK_INTER_THRES 1000
|
|
|
|
#endif
|
|
|
|
|
2007-10-15 08:05:11 +00:00
|
|
|
/* Specifies the string used to report the version and release date on the
|
|
|
|
* statistics page. May be defined to the empty string ("") to permanently
|
|
|
|
* disable the feature.
|
|
|
|
*/
|
|
|
|
#ifndef STATS_VERSION_STRING
|
|
|
|
#define STATS_VERSION_STRING " version " HAPROXY_VERSION ", released " HAPROXY_DATE
|
|
|
|
#endif
|
|
|
|
|
2009-05-10 06:53:33 +00:00
|
|
|
/* Maximum signal queue size, and also number of different signals we can
|
|
|
|
* handle.
|
|
|
|
*/
|
|
|
|
#ifndef MAX_SIGNAL
|
|
|
|
#define MAX_SIGNAL 256
|
|
|
|
#endif
|
|
|
|
|
2009-08-16 08:08:02 +00:00
|
|
|
/* Maximum host name length */
|
|
|
|
#ifndef MAX_HOSTNAME_LEN
|
|
|
|
#define MAX_HOSTNAME_LEN 32
|
|
|
|
#endif
|
|
|
|
|
2009-10-10 19:06:49 +00:00
|
|
|
/* Maximum health check description length */
|
|
|
|
#ifndef HCHK_DESC_LEN
|
|
|
|
#define HCHK_DESC_LEN 128
|
|
|
|
#endif
|
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#endif /* _COMMON_DEFAULTS_H */
|