mirror of
https://github.com/haproxy/haproxy.git
synced 2026-07-07 00:03:09 -04:00
Some checks are pending
Contrib / admin/halog/ (push) Waiting to run
Contrib / dev/flags/ (push) Waiting to run
Contrib / dev/haring/ (push) Waiting to run
Contrib / dev/hpack/ (push) Waiting to run
Contrib / dev/poll/ (push) Waiting to run
FreeBSD / clang (push) Waiting to run
VTest / Generate Build Matrix (push) Waiting to run
VTest / (push) Blocked by required conditions
Windows / Windows, gcc, all features (push) Waiting to run
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.
70 lines
1.3 KiB
C
70 lines
1.3 KiB
C
#ifndef _HAPROXY_HALOAD_H
|
|
#define _HAPROXY_HALOAD_H
|
|
|
|
#include <import/ist.h>
|
|
#include <haproxy/list-t.h>
|
|
#include <haproxy/proxy-t.h>
|
|
#include <haproxy/server-t.h>
|
|
#include <haproxy/task-t.h>
|
|
|
|
struct hld_path {
|
|
char *path;
|
|
struct hld_path *next;
|
|
};
|
|
|
|
struct hld_url_cfg {
|
|
int ssl;
|
|
int is_quic;
|
|
int h2c;
|
|
char *addr;
|
|
char *raw_addr; // used only to set the host header value
|
|
char *srv_opts;
|
|
char *tls_opts;
|
|
char *alpn;
|
|
struct server *srv;
|
|
struct hld_path *paths;
|
|
struct hld_path *cur_path;
|
|
struct hld_url_cfg *next;
|
|
};
|
|
|
|
struct hld_url {
|
|
int mreqs;
|
|
int flags;
|
|
uint64_t tot_req;
|
|
uint64_t tot_rconn_done;
|
|
uint64_t tot_rconn_sent;
|
|
struct hld_url_cfg *cfg;
|
|
struct hld_url *next;
|
|
};
|
|
|
|
/* haload header */
|
|
struct hld_hdr {
|
|
struct ist name;
|
|
struct ist value;
|
|
struct list list;
|
|
};
|
|
|
|
extern const char *arg_host;
|
|
extern const char *arg_conn_hdr;
|
|
extern const char *arg_uri;
|
|
extern const char *arg_path; // TO REMOVE
|
|
extern struct list hld_hdrs;
|
|
extern struct hld_url_cfg *hld_url_cfgs;
|
|
|
|
extern struct proxy hld_proxy;
|
|
extern int arg_accu;
|
|
extern int arg_dura;
|
|
extern int arg_fast;
|
|
extern int arg_head;
|
|
extern int arg_hscd;
|
|
extern int arg_long;
|
|
extern int arg_mreqs;
|
|
extern int arg_reqs;
|
|
extern int arg_rcon;
|
|
extern int arg_slow;
|
|
extern int arg_serr;
|
|
extern int arg_usr;
|
|
extern int arg_thrd;
|
|
extern int arg_wait;
|
|
|
|
#endif /* _HAPROXY_HALOAD_H */
|