From: Frederic Lecaille Date: Thu, 19 Mar 2026 17:27:48 +0000 (+0100) Subject: MINOR: haload: import source code and documentation X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw//%22%22)?a=commitdiff_plain;h=HEAD;p=haproxy.git MINOR: haload: import source code and documentation This patch imports the implementation of haload, a lightweight, multi-threaded traffic generator designed to benchmark HTTP infrastructures under heavy loads. Built onto HAProxy's highly scalable architecture, it natively supports HTTP/1, HTTP/2, and HTTP/3 (QUIC). It uses the previously exposed initialization functions, the no-listener mode, the lightweight hbuf API, and the specialized hldstream object types to dynamically derive and generate its configuration in memory from basic command-line inputs. By leveraging HAProxy's internal HTX (Internal HTTP Native Representation) format, haload abstractly manipulates HTTP elements independently of the wire protocol. This abstraction allows it to generate unified requests and process responses seamlessly across HTTP/1.1, HTTP/2, or HTTP/3 without duplicating the payload handling logic for each version. - Makefile: Introduce the 'haload' compilation target and define HALOAD_OBJS. - src/haload.c, include/haproxy/haload.h: Add user and stream task scheduling handlers, HTX-driven traffic orchestration mechanisms, and terminal benchmarking statistical summary rendering. - src/haload_init.c: Implement program arguments parsing, fileless HAProxy memory configuration generation, and target URL allocations. - src/stconn.c: Wire up sc_attach_mux() to properly allocate the specific tasklet context when dealing with a haload stream. - doc/haload.txt: Add detailed documentation covering compilation, flags, and usage examples. --- diff --git a/Makefile b/Makefile index 9b7e04b66..fd33984ae 100644 --- a/Makefile +++ b/Makefile @@ -902,6 +902,7 @@ endif # TARGET OBJS = HATERM_OBJS = +HALOAD_OBJS = ifneq ($(EXTRA_OBJS),) OBJS += $(EXTRA_OBJS) @@ -957,6 +958,8 @@ endif HATERM_OBJS += $(OBJS) src/haterm_init.o src/hbuf.o +HALOAD_OBJS += $(OBJS) src/haload_init.o src/haload.o src/hbuf.o + # Used only for forced dependency checking. May be cleared during development. INCLUDES = $(wildcard include/*/*.h) DEP = $(INCLUDES) .build_opts @@ -1007,6 +1010,9 @@ haproxy: $(OPTIONS_OBJS) $(OBJS) haterm: $(OPTIONS_OBJS) $(HATERM_OBJS) $(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS) +haload: $(OPTIONS_OBJS) $(HALOAD_OBJS) + $(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS) + objsize: haproxy $(Q)objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort diff --git a/doc/haload.txt b/doc/haload.txt new file mode 100644 index 000000000..c82e6d92f --- /dev/null +++ b/doc/haload.txt @@ -0,0 +1,146 @@ +------ + HALoad + ------ + HAProxy's dummy HTTP + client for benchmarks + +1. Background +------------- + +HALoad is a lightweight, multi-threaded traffic generator designed to benchmark +HTTP infrastructures under heavy loads. Built directly onto HAProxy's highly +scalable core architecture, it shares its parent engine's efficient handling of +connections. This framework allows the tool to generate high-volume traffic +across all standard application layers, including HTTP/1, HTTP/2, and HTTP/3 +(QUIC), over either cleartext or secured TLS connections. + +The primary design goal is to provide a modernized alternative to legacy tools +like h1load, extending benchmarking capabilities to newer protocols. Notably, +HALoad introduces the concept of users (-u), a feature completely absent +from h1load. Here, a "user" strictly represents an independent, concurrent +HTTP client task. Under this architecture, each simulated client will +instantiate as many backend server connections as there are target URLs +specified on the command line. + +HALoad does not require any configuration file. Instead, the configuration is +dynamically derived from basic command line inputs. This ensures immediate +usability for test operators while retaining the ability to test complex, +multi-protocol setups. + + +2. Compilation +-------------- + +The compilation process mirrors standard HAProxy builds, specifying "haload" +as the compilation target via the command line: + + $ make -j $(nproc) TARGET=linux-glibc haload + +To enable encrypted communication layers (TLS/SSL): + + $ make TARGET=linux-glibc USE_OPENSSL=1 haload + +For advanced HTTP/3 over QUIC load testing: + + $ make -j $(nproc) TARGET=linux-glibc USE_OPENSSL=1 USE_QUIC=1 haload + +Because HALoad shares the code of the main HAProxy binary, it natively +inherits all standard HAProxy compiler flags, optimizations, and build +targets. + + +3. Execution +------------ + +HALoad displays its usage when run without argument or wrong arguments: + + Usage : haload [opts] [URL] + where may be any combination of: + -d