Malachi. Loadtest
(malachi v0.22.7)
View Source
A multi-core wire-protocol load generator: one BEAM process per connection, so N connections spread across all schedulers (unlike a single-threaded event loop). It drives produce/fetch/mixed/stream load and control-plane (user/acl) load against a running Malachi server, measuring throughput and latency.
run/1 is the entry point (the mix malachi.loadtest task is a thin wrapper). Metrics are collected
lock-free: an :counters array for ops/records/errors plus backpressure events (dropped connections,
server-shed overloaded produces, quota-refused rate_limited produces, and reconnects) and a
Malachi.Histogram for latency. A genuine error (any refusal other than those two) is also counted
under the reason the server gave, in a table the report returns as error_reasons, so a run that
records errors says which ones; the reasons always add up to errors. A worker connects and
authenticates, waits at a barrier so all connections start together, runs its scenario for
warmup + duration, and records only during the measured window. It is resilient: a shed produce
backs off and continues, and a dropped connection reconnects (capped) rather than aborting.
How the connections are OPENED is a strategy (:connect_strategy), because each one pays a full
credential verification on the server and opening hundreds at once is a self-inflicted auth storm:
:bounded(default) - at most:connect_concurrency(default 32) connections inside connect+auth at once; the next starts when one finishes. Keeps each auth's individual latency nearconcurrency / server_verify_rateinstead of the whole queue's drain time.:stagger- connectionistartsi * :connect_stagger_ms(default 100) after the first, with no in-flight bound. A time ramp that does not adapt to the server's verify rate.:all_at_once- every connection starts simultaneously (the storm, kept on purpose for reproducing it and for comparing with historical runs).
A connection that fails to open under any strategy fails the run with a SetupError naming how many
of how many failed, rather than crashing a linked worker.
Summary
Functions
Runs a load test and returns the report map. See the moduledoc / the mix malachi.loadtest task for
options; all are optional with sensible defaults.
Functions
Runs a load test and returns the report map. See the moduledoc / the mix malachi.loadtest task for
options; all are optional with sensible defaults.