Configuration Schema
Xylem uses TOML configuration files to define experiments. This reference documents the complete schema for experiment profiles.
Overview
A complete Xylem configuration file contains the following sections:
[experiment] # Experiment metadata and duration
[[traffic_groups]] # One or more traffic generation groups with protocol_config
[output] # Output format and destination
[stats] # Optional statistics settings
[request_dump] # Optional request CSV dump settings
[thresholds] # Optional pass/fail limits on the results
[validity] # Optional checks that the run applied its load
Every section, and every table inside one, rejects unknown keys, except that
the keys of [thresholds] are metric names; see
unknown and removed keys.
Experiment Section
The [experiment] section defines metadata and experiment-wide settings.
[experiment]
name = "redis-bench"
description = "Redis benchmark with latency/throughput agent separation"
duration = "30s"
seed = 42
Fields
name(string, required): Name of the experimentdescription(string, optional): Description of the experimentduration(string, required): Duration in format “Ns”, “Nm”, “Nh” (seconds, minutes, hours)seed(integer, optional): Random seed for reproducibility. Each traffic group’s protocol on each thread draws its keys, values and sizes from its own seed derived from this one, so threads do not repeat each other’s keys, and each connection of apoissongroup draws its arrivals from its own derived seed. Without a seed, both come from OS entropy. Earlier versions gave every thread this seed itself, so a given seed now generates different keys than it did there.drain_timeout(string, default"1s"): after the measurement window, how long to wait for responses that are still pending. Nothing is sent during the drain. Requests still pending when it ends count astimed_out; see run phases.setup_timeout(string, default"10s", more than zero): how long a connection may take to set up, counted from the start of its connect, so it includes the connect and the wait for the other threads to open theirs. A connection whose protocol setup (such as Redis AUTH, the ClickHouse Hello or the HTTP/2 preface) has not finished by then fails the run. It also bounds preload (such as aninsert_phase): a thread that receives nothing for this long while it preloads fails the run, however long the whole preload takes; see run phases.tx_timestamp_timeout(string, default"10ms", more than zero): withtimestamps = "kernel"or{ hardware = ... }, how long the latency sample of a response that arrived before its request’s TX timestamp waits for the stamp, counted from the receive. The request completes at once; a sample whose stamp did not arrive by then is measured in cycles and counts inkernel_split_missing.tx; see timestamps.busy_poll_us(integer, optional, at least 1): turn on busy polling with this budget in microseconds; see busy polling. Off when unset.numa_membind(boolean, defaulttrue): bind each worker thread’s memory to the NUMA node of the CPU it is pinned to; see NUMA memory binding.
Busy polling
By default a worker thread that has nothing to send waits in its transport’s
poll (epoll_wait for the kernel transports) until a connection is ready or
its next deadline comes, so the kernel has to wake it for each response.
With busy_poll_us = N, for N microseconds after each send and after each
poll that finds a ready connection, the thread polls with a zero timeout
instead, and sees a response without that wakeup. Once N microseconds pass
with neither, it waits in its poll as without busy polling, until the next
send or event. The budget counts from the start of the run too.
[experiment]
name = "nvme-qd1"
duration = "30s"
busy_poll_us = 1000
CPU cost: every worker thread keeps its core at 100% while it spins. With
a budget longer than the gaps between a thread’s sends and responses, which
is the usual case under load, that is the whole run. A smaller budget bounds
the burn when a thread is idle, such as between widely spaced open-loop
sends; a request whose response takes longer than the budget waits in a
poll. Pin each thread to a core of its own (threads) and keep that core
free of other work.
Busy polling helps where the wakeup is a large part of the latency: one
request in flight on a fast target, such as NVMe/TCP at queue depth 1. It
works the same for every transport and protocol, and changes neither where
timestamps are taken nor when sends, timeouts, the end of the window and the
drain happen. ntcp’s DPDK and AF_XDP backends already spin in their polls,
so it changes nothing there; with TUN, ntcp drives its stack on each poll
instead of sleeping on the device. The JSON results record the budget as
experiment.busy_poll_us, null without busy polling.
NUMA memory binding
Each worker thread is pinned to the CPU of its thread ID (threads). On a
host with more than one NUMA node, xylem also binds each worker thread’s
memory to its CPU’s node (set_mempolicy(MPOL_BIND)), from the thread’s
first allocation on: its stack, its malloc arena, and everything its worker
builds, such as connections, buffers and statistics. The kernel’s NUMA
balancing then neither moves that memory nor pauses the thread about once a
second to scan it for misplaced pages, which otherwise delays sends by a few
hundred microseconds.
[experiment]
name = "no-binding"
duration = "30s"
numa_membind = false
- Memory the main thread allocated before the worker threads started, such as the parsed profile, stays where it is.
- The binding replaces any memory policy the process started with, such as
numactl --membind’s, for the worker threads. Setnuma_membind = falseto keep it. - A bound thread allocates only from its node. If that node runs out of memory, the kernel’s OOM killer acts rather than take memory from another node.
- On a single-node host, or when the threads are not pinned, xylem logs that
it binds nothing and runs as with
numa_membind = false. - If the kernel refuses the binding (a container or a seccomp filter may),
the run fails before it starts, with the errno; set
numa_membind = falseto run without it. Xylem never changes host settings such askernel.numa_balancing.
The JSON results record each worker thread’s memory policy as the thread reported it before it built its worker; see worker threads.
Transport and Target
Each traffic group specifies its own transport ("tcp", "udp", "unix", or
"ntcp" in builds with the ntcp feature)
and target. Transport defaults to "tcp"; there is no global [target] section.
Groups sharing a thread must use the same transport. TCP and UDP targets must be
numeric socket addresses, such as "127.0.0.1:6379" or "[::1]:6379"; hostname
resolution is not supported. Unix targets are filesystem paths.
Traffic Groups
Traffic groups define how workload is distributed across threads and connections. Each group has its own protocol, target, and configuration. You can define multiple [[traffic_groups]] sections.
[[traffic_groups]]
name = "main"
protocol = "redis"
target = "127.0.0.1:6379"
threads = [0, 1, 2, 3]
connections_per_thread = 25
max_pending_per_connection = 10
[traffic_groups.protocol_config.keys]
strategy = "zipfian"
n = 1000000
theta = 0.99
value_size = 64
[traffic_groups.protocol_config.operations]
strategy = "fixed"
operation = "get"
[traffic_groups.traffic_policy]
type = "fixed-rate"
rate = 100.0
[traffic_groups.sampling_policy]
type = "unlimited"
Traffic Group Fields
name(string, required): Name for this traffic groupprotocol(string, required): Application protocol for this group. Supported values:"redis""http""memcached-binary""memcached-ascii""xylem-echo"(testing only)
target(string, required): Target address for this group. Format depends on transport:- TCP/UDP: numeric
"ip:port"or"[ipv6]:port" - Unix socket:
"/path/to/socket"
- TCP/UDP: numeric
transport(string, default"tcp"):"tcp","udp","unix", or"ntcp"(user-space TCP, needs the top-level[ntcp]section)timestamps(default"user"): timestamp source,"user","kernel",{ hardware = "<interface>" }(tcpandudpon Linux only), or"nic"(ntcpwith the DPDK backend only); the same for groups sharing a thread. See timestamps.threads(array of integers, required): Thread IDs to use for this groupconnections_per_thread(integer, required): Number of connections per threadmax_pending_per_connection(integer, required): Maximum pending requests per connection1= no pipelining (accurate latency measurement)- Higher values = pipelining enabled
on_error(string, default"count"): what an error reply (a Redis error, an HTTP 4xx or 5xx, a memcachedSERVER_ERROR, …) does"count"= it completes its request and counts inrequests.errors; see error replies"abort"= the run fails at the first one, naming the group, connection and reply; no results are written
Protocol Configuration
[traffic_groups.protocol_config.keys] - Key distribution for KV protocols:
strategy(string, required): Distribution strategy"sequential": Sequential keys starting fromstart"random": Uniform random distribution"round-robin": Cycle through keys"zipfian": Zipfian distribution (power law, hot keys)"gaussian": Normal distribution (temporal locality)
n(integer, required for zipfian): Key space sizemax(integer, required for random/round-robin): Maximum key valuestart(integer, optional for sequential): Starting key (default: 0)theta(float, required for zipfian): Skew parameter (0.99 = high skew)mean_pct(float, required for gaussian): Mean as percentage of keyspace (0.0-1.0)std_dev_pct(float, required for gaussian): Standard deviation as percentage (0.0-1.0)value_size(integer, required): Size of values in bytes
[traffic_groups.protocol_config.operations] - Operation configuration:
Fixed operation:
[traffic_groups.protocol_config.operations]
strategy = "fixed"
operation = "get" # or "set", "incr"
Weighted operations:
[traffic_groups.protocol_config.operations]
strategy = "weighted"
[[traffic_groups.protocol_config.operations.commands]]
name = "get"
weight = 0.8
[[traffic_groups.protocol_config.operations.commands]]
name = "set"
weight = 0.2
[traffic_groups.protocol_config.value_size] - Optional value size configuration:
[traffic_groups.protocol_config.value_size]
strategy = "fixed"
size = 128
Or variable sizes:
[traffic_groups.protocol_config.value_size]
strategy = "uniform"
min = 64
max = 4096
Redis connection setup - Optional fields directly in [traffic_groups.protocol_config], sent once by every connection before any other request:
auth(table, optional): Authenticate withAUTH. Set exactly one ofpasswordandpassword_env.username(string, optional): ACL user (Redis 6+); without it,AUTH <password>checksrequirepasspassword(string): Passwordpassword_env(string): Environment variable holding the password, read when the run starts; an unset variable fails validation
db(integer, optional): Database toSELECT, 0 to 2147483647 (default: none, so database 0)resp(integer, optional):2(default, no HELLO) or3(sendsHELLO 3)
[traffic_groups.protocol_config]
auth = { username = "bench", password_env = "REDIS_PASSWORD" }
db = 3
resp = 3
Setup requests are not measured, counted or dumped, and an error reply to one fails the run. See Redis connection setup.
Traffic Policy
[traffic_groups.traffic_policy] - Rate control:
type(string, required):"closed-loop": Send as fast as possible (max throughput)"fixed-rate": Evenly spaced sends at a fixed rate"poisson": Poisson arrival process (open-loop)
rate(float, required for fixed-rate/poisson): Requests per second of the whole group, across all its threads and connectionsdispatch(string, rate-driven policies only): how the arrivals reach the connections,"connection"(default) or"group"; see group dispatch
Every policy except closed-loop is rate-driven, including adaptive and the
time-varying sinusoidal, ramp, spike and sawtooth patterns. Each
connection of a rate-driven group follows an intended schedule: every
request is due one inter-arrival time after the previous request’s intended
time, not after its actual send.
The rates are the group’s, shared by its N connections
(connections_per_thread times the length of threads), numbered
c = 0 .. N-1 across its threads. Every connection of every thread and group
counts its schedule from one start time that all threads share, set once every
thread has connected. fixed-rate interleaves the connections into one stream:
connection c sends its k-th request (c + k·N)/rate seconds after the
start (to the nanosecond, rounded down, without accumulating error), so the
group sends one request every 1/rate seconds and no two connections share a
send time. A poisson connection is a Poisson process at rate/N, its first
arrival one exponential inter-arrival after the start. adaptive and the
patterns run each connection at 1/N of the configured rates, connection c
starting c/N of a request into its schedule, and a pattern’s time counts from
the start. A connection that can first send after the start, because it was
still connecting or setting up, begins at its first intended time from then
on; the sends it missed are not counted as unsent.
Inter-arrival times are fixed (fixed-rate), exponential samples (poisson),
one interval at the current rate (adaptive), or, for patterns, the time until
the pattern’s rate, held constant over 10 ms steps, accumulates one request.
A pattern that drops to zero schedules nothing, so a pause leaves no backlog.
A connection sends when its next intended time has arrived, its pipeline has
room and its protocol is ready. When the sender falls behind (a full pipeline,
a slow server, preemption), the overdue requests go out back to back as soon as
it can send again; none is skipped. A request’s latency is measured from its
intended send time: the send lag (actual minus intended send time) plus the
service latency from the send to the response. Without this, the delay of
requests that could not be sent on time would be omitted from the results
(coordinated omission). adaptive adjusts its rate from these latencies, so a
growing backlog backs its rate off. closed-loop requests have no intended time
and no send lag. See request accounting.
[traffic_groups.traffic_policy]
type = "closed-loop"
[traffic_groups.traffic_policy]
type = "fixed-rate"
rate = 100.0 # 100 req/s for the group, evenly spaced
[traffic_groups.traffic_policy]
type = "poisson"
rate = 50.0 # Mean 50 req/s for the group
Group dispatch
By default every connection runs its own schedule, so a request due on a
connection whose pipeline is full waits for that connection even while others
are idle. With max_pending_per_connection = 1, which protocols without
pipelining such as HTTP/1.1 need, the arrivals then wait for responses: their
sends go out late, and the load is no longer open-loop.
With dispatch = "group", each thread of the group runs one schedule, its
1/T share of the group’s rates for T threads, by the rules above with
thread t (its position in threads) in place of connection c:
fixed-rate threads interleave into one evenly spaced stream, and each
poisson thread is a Poisson process at rate/T, seeded per thread from
experiment.seed. Each arrival goes to the thread’s connection of the group
that has been idle longest: set up, its protocol ready, and its pipeline not
full. An arrival due while none is idle waits for the first to free up, with
its send lag and latency counted from its intended time, so it counts in
late_sends; arrivals still waiting at the end of the window count in
unsent. The schedule starts when the first connection is set up. Give the
group enough connections to cover the rate times the latency, plus bursts.
closed-loop takes no dispatch.
[traffic_groups.traffic_policy]
type = "poisson"
rate = 20000.0
dispatch = "group" # one arrival process per thread, sent on idle connections
Sampling Policy
[traffic_groups.sampling_policy] - Latency storage. If the section is
omitted, the group uses an auto-resizing HDR histogram with 3 significant
figures, which records every latency and merges independently of order.
type(string, required):"hdr-histogram"(default): HDR histogram of every latency.sigfigs(integer 1-5, default 3): precision of each value.max_value_us(integer, optional): upper bound in microseconds. Unset, the histogram grows to fit every value. Set, larger values are recorded as the bound and counted in theclamped_samplesoutput field.
"unlimited": store every latency; exact nearest-rank percentiles, memory grows with the request count."limited": keep a uniform random sample (reservoir) of at mostmax_sampleslatencies per bucket and connection. Merging weights each part by the number of latencies it saw, so percentiles describe the whole run, not its first requests.rate(float, default 1.0): fraction of latencies offered to the sample.max_samples(integer, default 131072).
"dd-sketch"(alpha,max_bins) and"t-digest"(compression): mergeable quantile sketches. T-digestcompressionmust be a positive integer; it defaults to 1000. Higher values use more memory and generally improve accuracy. This requirement applies to both group and global policies."none": Disable latency sampling (throughput/bytes still recorded)
For every type except none, the mean, min, max, standard deviation and
sample count are computed exactly from every recorded latency; only the
percentiles depend on the storage type.
DDSketch 0.4.2 uses floor-based value-to-bin mapping and corresponding bin
representatives; 0.3.x used ceiling-based mapping. Approximate percentiles,
and therefore percentile threshold results, can change for the same samples
and alpha. max_bins limits the number of logarithmic bins, not a numeric
latency range. When the observed values require more than that many bins, the
lowest bins collapse and their estimates can exceed the configured relative
error. Xylem places values up to and including 1 ns in the zero bucket and
truncates estimated values to whole nanoseconds; these can also prevent a
strict relative error bound, especially near zero.
The dependency’s public count saturates at usize::MAX on 32-bit targets;
Xylem’s independently tracked u64 sample count preserves the recorded count.
[traffic_groups.sampling_policy]
type = "unlimited"
[traffic_groups.sampling_policy]
type = "limited"
rate = 0.01 # 1% sampling
max_samples = 10000
# Disable latency sampling for this group
[traffic_groups.sampling_policy]
type = "none"
Stats Config
Top-level stats configuration ([stats]).
bucket_duration(string, default"1s"): time bucket for per-connection recordsinclude_records(bool, default false)sampling_policy(optional): global latency sampling policy; set totype = "none"to disable global latency recording; if omitted, the first traffic group’s policy is used
Other keys are rejected. The former streaming (Parquet) section was removed, so profiles that still set it fail to load.
Output Section
The [output] section configures where and how results are written.
[output]
format = "json"
file = "/tmp/results.json"
real_time = false
Fields
format(string, default"json"): Output format"json": Detailed JSON with experiment metadata, global and per-group statistics"human": Human-readable console output"html": HTML report with charts"both": Both JSON and HTML
file(string, required): Output file pathreal_time(boolean, default false): Must be false; real-time updates are not supported.html.library(string, default"chartjs"): Only"chartjs"is supported.html.theme(string, default"light"): Only"light"is supported.
Thresholds and Validity
[thresholds] maps a metric, optionally filtered to a traffic group, to a
list of expressions; [validity] tunes the checks that a run applied its
configured load:
[thresholds]
"latency" = ["p99 < 250us", "p99.9 < 1ms"]
"latency{group=latency-agent}" = ["p50 < 80us"]
"requests.timed_out" = ["rate < 0.001"]
"requests.errors" = ["rate < 0.01"]
[validity]
enabled = true
max_unsent_ratio = 0.001
max_late_send_ratio = 0.01
skip = []
thresholds(table of string lists, default empty): see Thresholds and Validity for metrics (includingrequests.errors,error_latencyand thelatency_breakdownparts), aggregations, units and evaluation. Its keys are checked as metrics, not as profile keys.validity.enabled(bool, default true): false disables every check.validity.max_unsent_ratio(number from 0 to 1, default 0.001)validity.max_late_send_ratio(number from 0 to 1, default 0.01)validity.skip(list of"unsent","late_sends", default empty)
Other [validity] keys are rejected.
Request Dump
Use [request_dump] to record outgoing requests as CSV files:
[request_dump]
directory = "/tmp/xylem-requests"
prefix = "requests"
rotation = "hourly"
encoding = "hex"
The directory is required. Rotation defaults to "never"; other values are
"minutely", "hourly", "daily", or { size = 1048576 } for a byte limit.
Encoding defaults to "hex"; "base64", "utf8", "escaped", and "none" are
also available. max_files optionally limits retained dump files.
Generated JSON Schema
The checked-in profile schema is generated directly from the Rust configuration types. Regenerate it with:
cargo run --quiet --bin xylem -- schema > schema/profile.schema.json
Keep stdout separate from Cargo diagnostics on stderr. CI checks JSON validity
and compares the committed schema to the command’s output. The schema describes
the configuration’s shape; runtime validation also checks supported options,
addresses, and protocol settings. detailed-json is obsolete; use json.
Complete Example
[experiment]
name = "redis-bench"
description = "Redis benchmark with latency/throughput separation"
duration = "30s"
seed = 42
# Latency agent - accurate latency measurement
[[traffic_groups]]
transport = "tcp"
name = "latency-agent"
protocol = "redis"
target = "127.0.0.1:6379"
threads = [0]
connections_per_thread = 10
max_pending_per_connection = 1
[traffic_groups.protocol_config.keys]
strategy = "zipfian"
n = 1000000
theta = 0.99
value_size = 64
[traffic_groups.protocol_config.operations]
strategy = "fixed"
operation = "get"
[traffic_groups.traffic_policy]
type = "poisson"
rate = 100.0
[traffic_groups.sampling_policy]
type = "unlimited"
# Throughput agent - high throughput generation
[[traffic_groups]]
name = "throughput-agent"
protocol = "redis"
target = "127.0.0.1:6379"
threads = [1, 2, 3]
connections_per_thread = 25
max_pending_per_connection = 32
[traffic_groups.protocol_config.keys]
strategy = "zipfian"
n = 1000000
theta = 0.99
value_size = 64
[traffic_groups.protocol_config.operations]
strategy = "weighted"
[[traffic_groups.protocol_config.operations.commands]]
name = "get"
weight = 0.8
[[traffic_groups.protocol_config.operations.commands]]
name = "set"
weight = 0.2
[traffic_groups.traffic_policy]
type = "closed-loop"
[traffic_groups.sampling_policy]
type = "limited"
rate = 0.01
max_samples = 10000
[output]
format = "json"
file = "/tmp/redis-bench-results.json"
real_time = false