R
Redis data loader
Data sources & feeders availableFeed VUs values from a Redis list/stream over raw RESP — a distributed feeder.
$ loadr plugin install redis-loader
# Distributed shared data feeder, driven by the `loadr-plugin-redis-loader`
# native SERVICE plugin.
#
# Unlike a protocol plugin (which handles requests to a URL scheme), a service
# plugin has a start/stop lifecycle: loadr calls `start(config)` once before the
# run and `stop()` once after. On start this plugin connects to Redis over raw
# RESP (no `redis` crate, no OpenSSL, no async runtime — just a blocking socket,
# the same approach as `loadr-plugin-redis`), then binds a tiny local line
# endpoint and returns its address, e.g.:
#
# → redis-loader feeder at 127.0.0.1:41881
#
# Every VU that opens that endpoint and reads a line gets the NEXT shared value,
# popped from the Redis list (LPOP / BLPOP / LMOVE) or read from the stream
# (XREAD). Because the backing key lives in Redis, the same feed is shared
# across EVERY worker pointed at the same server — a distributed feeder that
# hands each value out exactly once (list) or fans stream entries in, with no
# per-VU Redis client.
#
# Seed the list first, e.g.:
# redis-cli RPUSH loadr:emails a@x.com b@x.com c@x.com ...
#
# Build + install the plugin, then run:
# cargo build -p loadr-plugin-redis-loader --release
# mkdir -p dist && cp plugins/loadr-plugin-redis-loader/plugin.toml dist/ \
# && cp target/release/libloadr_plugin_redis_loader.so dist/
# loadr plugin install dist
# loadr run examples/plugins/redis-loader.yaml
#
# Or point the plan's `plugins:` entry at the built artifact directly (below).
name: redis-loader
description: Distributed shared feeder handing VUs values from a Redis list/stream
plugins:
# Resolve `redis-loader` by name from the plugins dir (after
# `loadr plugin install`). To run straight from a build tree instead, set:
# path: target/release/libloadr_plugin_redis_loader.so
- name: redis-loader
config:
# Redis target. `redis://host:port[/db]`; `rediss://` is the TLS alias.
url: redis://127.0.0.1:6379
# The list (or stream) key VUs are fed from.
key: loadr:emails
# `list` pops values; `stream` reads entries. Default: list.
source: list
# `exhaust` (default): stop feeding when the list is empty.
# `block`: wait up to `block_ms` for a value (BLPOP / XREAD BLOCK).
# `cycle`: rotate the same values forever (LMOVE key key LEFT RIGHT),
# so a fixed pool feeds an open-ended run round-robin.
mode: cycle
# Local address the feeder endpoint binds to. Port 0 = ephemeral; the
# bound address is printed when the run starts.
bind: 127.0.0.1:0
# Block timeout (ms) for `mode: block`.
block_ms: 5000
scenarios:
# A steady signup flow: every VU across every worker draws its next email
# address from the one shared Redis-backed feed, so no two VUs reuse a value
# (in `exhaust` mode) even when the run is sharded across machines.
signups:
executor: constant-vus
vus: 25
duration: 30s
flow:
# Each VU reads its next shared value from the feeder endpoint. The `NEXT`
# request line is answered with one value + a newline (an empty line means
# the feed is exhausted). See the address printed at run start.
- request:
name: draw shared value
url: tcp://127.0.0.1:0 # replace with the printed feeder address
socket:
send_text: "NEXT\n" # one request line -> one value + newline
read_bytes: 256
read_timeout: 2s
checks:
- { type: duration, name: feeder is fast, max: 25ms }
thresholds:
checks: [ "rate>0.99" ]
A real run: install from the signed index, then watch the plugin work.
A runtime plugin, never in the binary
Installing pulls a per-platform driver from the signed index, verifies its SHA-256 and checks its ABI before it ever loads. Remove it any time with loadr plugin remove redis-loader.