3.4.1. Advanced features : Management
- HAProxy is designed to remain extremely stable and safe to manage in a regular
- production environment. It is provided as a single executable file which doesn't
- require any installation process. Multiple versions can easily coexist, meaning
- that it's possible (and recommended) to upgrade instances progressively by
- order of importance instead of migrating all of them at once. Configuration
- files are easily versioned. Configuration checking is done off-line so it
- doesn't require to restart a service that will possibly fail. During
- configuration checks, a number of advanced mistakes may be detected (e.g. a rule
- hiding another one, or stickiness that will not work) and detailed warnings and
- configuration hints are proposed to fix them. Backwards configuration file
- compatibility goes very far away in time, with version 1.5 still fully
- supporting configurations for versions 1.1 written 13 years before, and 1.6
- only dropping support for almost unused, obsolete keywords that can be done
- differently. The configuration and software upgrade mechanism is smooth and non
- disruptive in that it allows old and new processes to coexist on the system,
- each handling its own connections. System status, build options, and library
- compatibility are reported on startup.
-
- Some advanced features allow an application administrator to smoothly stop a
- server, detect when there's no activity on it anymore, then take it off-line,
- stop it, upgrade it and ensure it doesn't take any traffic while being upgraded,
- then test it again through the normal path without opening it to the public, and
- all of this without touching HAProxy at all. This ensures that even complicated
- production operations may be done during opening hours with all technical
- resources available.
-
- The process tries to save resources as much as possible, uses memory pools to
- save on allocation time and limit memory fragmentation, releases payload buffers
- as soon as their contents are sent, and supports enforcing strong memory limits
- above which connections have to wait for a buffer to become available instead of
- allocating more memory. This system helps guarantee memory usage in certain
- strict environments.
-
- A command line interface (CLI) is available as a UNIX or TCP socket, to perform
- a number of operations and to retrieve troubleshooting information. Everything
- done on this socket doesn't require a configuration change, so it is mostly used
- for temporary changes. Using this interface it is possible to change a server's
- address, weight and status, to consult statistics and clear counters, dump and
- clear stickiness tables, possibly selectively by key criteria, dump and kill
- client-side and server-side connections, dump captured errors with a detailed
- analysis of the exact cause and location of the error, dump, add and remove
- entries from ACLs and maps, update TLS shared secrets, apply connection limits
- and rate limits on the fly to arbitrary frontends (useful in shared hosting
- environments), and disable a specific frontend to release a listening port
- (useful when daytime operations are forbidden and a fix is needed nonetheless).
-
- For environments where SNMP is mandatory, at least two agents exist, one is
- provided with the HAProxy sources and relies on the Net-SNMP Perl module.
- Another one is provided with the commercial packages and doesn't require Perl.
- Both are roughly equivalent in terms of coverage.
-
- It is often recommended to install 4 utilities on the machine where HAProxy is
- deployed :
-
- - socat (in order to connect to the CLI, though certain forks of netcat can
- also do it to some extents);
-
- - halog from the latest HAProxy version : this is the log analysis tool, it
- parses native TCP and HTTP logs extremely fast (1 to 2 GB per second) and
- extracts useful information and statistics such as requests per URL, per
- source address, URLs sorted by response time or error rate, termination
- codes etc. It was designed to be deployed on the production servers to
- help troubleshoot live issues so it has to be there ready to be used;
-
- - tcpdump : this is highly recommended to take the network traces needed to
- troubleshoot an issue that was made visible in the logs. There is a moment
- where application and haproxy's analysis will diverge and the network traces
- are the only way to say who's right and who's wrong. It's also fairly common
- to detect bugs in network stacks and hypervisors thanks to tcpdump;
-
- - strace : it is tcpdump's companion. It will report what HAProxy really sees
- and will help sort out the issues the operating system is responsible for
- from the ones HAProxy is responsible for. Strace is often requested when a
- bug in HAProxy is suspected;