Literals are sent in two ways: - in EOB state, unencoded and prefixed with their length - in FIXED state, huffman-encoded And references are only sent in FIXED state. The API promises that the amount of data will not grow by more than 5 bytes every 65535 input bytes (the comment was adjusted to remind this last point). This is guaranteed by the literal encoding in EOB state (BT, LEN, NLEN + bytes), which is supposed to be the worst case by design. However, as reported by Greg KH, this is currently not true: the test that decides whether or not to switch to FIXED state to send references doesn't properly account for the number of bytes needed to roll back to the *exact* same state in EOB, which means sending EOB, BT, alignment, LEN and NLEN in addition to the referenced bytes, versus sending the encoding for the reference. By not taking into account the cost of returning to the initial state (BT+LEN+NLEN), it was possible to stay too long in the FIXED state and to consume the extra bytes that are needed to return to the EOB state, resulting in producing much more data in case of multiple switchovers (up to 6.25% increase was measured in tests, or 1/16, which matches worst case estimates based on the code). And this check is only valid when starting from EOB (in order to restore the same state that offers this guarantee). When already in FIXED state, the encoded reference is always smaller than or same size as the data. The smallest match length we support is 4 bytes, and when encoded this is no more than 28 bits, so it is safe to stay in FIXED state as long as needed while checking the possibility of switching back to EOB. This very slightly reduces the compression ratio (-0.17% on a linux kernel source) but makes sure we respect the API promise of no more than 5 extra bytes per 65535 of input. A side effect of the slightly simpler check is an ~7.5% performance increase in compression speed. Many thanks to Greg for the detailed report allowing to reproduce the issue. This is libslz upstream commit 002e838935bf298d967f670036efa95822b6c84e. Note: in haproxy's default configuration (tune.bufsize 16384, tune.maxrewrite 1024), this problem cannot be triggered, because the reserve limits input to 15360 bytes, and the overflow is maximum 960 bytes resulting in 16320 bytes total, which still fits into the buffer. However, reducing tune.maxrewrite below 964, or tune.bufsize above 17408 can result in overflows for specially crafted patterns. A workaround for larger buffers consists in always setting tune.bufsize to at least 1/16 of tune.bufsize. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://www.mail-archive.com/haproxy@formilux.org/msg46837.html |
||
|---|---|---|
| .github | ||
| addons | ||
| admin | ||
| dev | ||
| doc | ||
| examples | ||
| include | ||
| reg-tests | ||
| scripts | ||
| src | ||
| tests | ||
| .cirrus.yml | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| .travis.yml | ||
| BRANCHES | ||
| BSDmakefile | ||
| CHANGELOG | ||
| CONTRIBUTING | ||
| INSTALL | ||
| LICENSE | ||
| MAINTAINERS | ||
| Makefile | ||
| README.md | ||
| SUBVERS | ||
| VERDATE | ||
| VERSION | ||
HAProxy
HAProxy is a free, very fast and reliable reverse-proxy offering high availability, load balancing, and proxying for TCP and HTTP-based applications.
Installation
The INSTALL file describes how to build HAProxy. A list of packages is also available on the wiki.
Getting help
The discourse and the mailing-list are available for questions or configuration assistance. You can also use the slack or IRC channel. Please don't use the issue tracker for these.
The issue tracker is only for bug reports or feature requests.
Documentation
The HAProxy documentation has been split into a number of different files for ease of use. It is available in text format as well as HTML. The wiki is also meant to replace the old architecture guide.
Please refer to the following files depending on what you're looking for:
- INSTALL for instructions on how to build and install HAProxy
- BRANCHES to understand the project's life cycle and what version to use
- LICENSE for the project's license
- CONTRIBUTING for the process to follow to submit contributions
The more detailed documentation is located into the doc/ directory:
- doc/intro.txt for a quick introduction on HAProxy
- doc/configuration.txt for the configuration's reference manual
- doc/lua.txt for the Lua's reference manual
- doc/SPOE.txt for how to use the SPOE engine
- doc/network-namespaces.txt for how to use network namespaces under Linux
- doc/management.txt for the management guide
- doc/regression-testing.txt for how to use the regression testing suite
- doc/peers.txt for the peers protocol reference
- doc/coding-style.txt for how to adopt HAProxy's coding style
- doc/internals for developer-specific documentation (not all up to date)
License
HAProxy is licensed under GPL 2 or any later version, the headers under LGPL 2.1. See the LICENSE file for a more detailed explanation.
