1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use Duration;
use Client;
use crateConfig;
use crate;
/// Build the HTTP client used for load generation.
///
/// # Connection pool sizing
///
/// `pool_max_idle_per_host` and `max_concurrency` bound **different things**
/// and are deliberately not derived from one another any more:
///
/// * `max_concurrency` — requests *executing* right now. Work, not memory.
/// * `pool_max_idle_per_host` — sockets *retained after* finishing. Memory.
///
/// They were previously conflated, so the idle pool inherited the in-flight
/// ceiling. That is wasteful, but measurement shows it is *not* what sets the
/// memory ceiling: holding this at 1000 and cutting the idle pool from 1000 to
/// 64 changed peak RSS by 0.6%. The term that actually dominates is
/// `max_concurrency`, because every in-flight request holds a hyper read buffer
/// sized to its body and reqwest exposes no knob to shrink it. See
/// `DEFAULT_MAX_CONCURRENCY` for that measurement.
///
/// Both are kept configurable because they pull in opposite directions for the
/// *measurement*, not just for memory. A larger idle pool means fewer TCP and
/// TLS handshakes, so a run measures steady-state throughput. A smaller one
/// means handshakes appear in the latency figures.
///
/// # TLS
///
/// Certificate verification is **disabled unconditionally**. That is the right
/// default for a load generator pointed at staging targets with self-signed or
/// expired certificates, and it is why the tool can measure a service whose
/// TLS a real client would reject. The consequence to be aware of: the tool
/// cannot measure TLS handshake rejection, and a target with an expired
/// certificate reports 200s here. Expose this as a flag rather than leaving it
/// implicit when adding a TLS-sensitive measurement mode.