Locust Test Data: Seeded JSON User Pools for Realistic Load Tests
Locust test data usually starts as a few lines inside the locustfile: one
test account in on_start, a random.choice() over five product IDs, and
@task weights that guess at the traffic mix. That's enough to get
requests flowing. It isn't enough to get results you can trust, because
every simulated user logs in as the same person, hits the same cached
pages and only ever takes the happy path. This post moves the data out
of the code and into a committed, seeded JSON pool: one row per
simulated user, with its own account, its own request mix, a few planted
bad requests, and a split that keeps distributed workers from
duplicating each other.
JsonFabrica generates the pool, and it's only a JSON-over-HTTP API.
There's no Locust plugin or Python package. A short Python script calls
the API and commits the result, and the locustfile reads that file with
json.load. The load test itself never calls JsonFabrica. This is the
Locust-specific companion to the general guide on
test data for load testing, which
covers skew and cardinality independently of the load tool.
The code below ran with Locust 2.47.0 on Python 3.14, against a small
throwaway shop API written for this post (Python standard library, one
process). Headless runs with 50 and 100 users passed, and so did the
distributed setups: --processes 2, and one master with two separate
--worker processes. All of them ran on one machine; I didn't run
workers on separate hosts. The pool was rendered with the JsonFabrica
template engine, and the regen script ran against a local stand-in for
the API that uses the same engine. All outputs below come from those
runs. The latencies are from a toy app on a shared machine, so they show
direction, not benchmark numbers.
Why Locust test data goes wrong
The running example is a shop API with four endpoints. POST /login
returns a token, GET /products/{id} returns one of 500 products from a
small in-memory cache, GET /search?q= runs a search, and POST /orders
creates an order or rejects it with a 422. Like many real apps, it
allows one session per account: a new login replaces the account's
previous session.
Three problems show up in almost every Locust suite that keeps its data in code:
- Every simulated user shares one login. One account in
on_startis the quickest way to get a token. But per-account state is real: sessions, rate limits, carts, row locks, per-user caches. A thousand users behind one account test a situation production never sees, or, like here, they knock each other's sessions out. - Payloads repeat, so caches stay warm. A handful of hard-coded IDs and search terms means everything after the first request is a cache hit. Latency looks great and says nothing about the misses real traffic causes.
- Workers duplicate each other. Each Locust worker is a separate process that loads the locustfile on its own. If the file says "take the next account", every worker starts at the first account, and two workers become two copies of the same users.
All three get fixed in the data, not in the Locust settings: one row per simulated user, rows that differ in what they request, and a rule for which worker gets which rows.
A seeded user pool instead of random data in the locustfile
The pool comes from one template. Every row is a complete simulated user: credentials, a persona that decides what the user does, the products it views, the searches it runs and the order it places. Every 25th user is planted with an order the app must reject:
{
"users": [
<for(g, 1, getParam('groups', 8))>
<setVar('gg', appendBefore('0', getVar('g'), 2))>
<for(j, 1, 25)><setVar('jj', appendBefore('0', getVar('j'), 2))>
<if(getVar('g') > 1 || getVar('j') > 1)>,<endIf>
{
"id": "u<getVar('gg')><getVar('jj')>",
"email": "load-u<getVar('gg')><getVar('jj')>@example.test",
"password": "<getRandomTextWithSpaces(12, 20)>",
"persona": <if(getVar('j') == 25)>"buy"
<elseIf(getRandomBoolean(0.45))>"browse"
<elseIf(getRandomBoolean(0.6))>"search"
<else>"buy"<endIf>,
"views": [<for(k, 1, 4)><if(getVar('k') > 1)>, <endIf>
<if(getRandomBoolean(0.8))>
"p-<appendBefore('0', getRandomNumber(1, 20), 3)>"
<else>"p-<appendBefore('0', getRandomNumber(21, 500), 3)>"<endIf>
<end_for>],
"searches": [
"<getRandomElement('desk', 'lamp', 'chair', 'usb hub', 'webcam')>",
"<toLowerCase(getRandomSurname())>"
],
<if(getVar('j') == 25)>
<setVar('bad', getRandomElement('unknown-product', 'zero-qty', 'empty-cart'))>
<endIf>
"order": <if(getVar('j') < 25)>{ "items": [{
"productId": "p-<appendBefore('0', getRandomNumber(1, 500), 3)>",
"qty": <getRandomNumber(1, 3)> }] }
<elseIf(getVar('bad') == 'unknown-product')>
{ "items": [{ "productId": "p-999", "qty": 1 }] }
<elseIf(getVar('bad') == 'zero-qty')>
{ "items": [{ "productId": "p-007", "qty": 0 }] }
<else>{ "items": [] }<endIf>,
"bad": <if(getVar('j') == 25)>"<getVar('bad')>"<else>null<endIf>
}<end_for><end_for>
]
}
What each part does:
- Two loops make "every 25th user". Template expressions have
comparisons (
==,!=,<,<=,>,>=) and&&/||but no arithmetic, so there's no modulo. Instead, the outer loop counts groups and the inner loop counts 25 users per group, andj == 25marks the last user of each group. The default 8 groups make 200 users, 8 of them planted. Loop bounds are inclusive, and the comma guard uses||so that only the very first row gets no comma. The control flow docs coverforandif/elseIf/else. - Each variable is read more than once.
ggandjjare the zero-padded group and position, built withappendBefore, and each one goes into bothidandemail.badpicks the kind of planted error and then drives both theorderand thebadfield. Everything else is inline. - Accounts are unique by construction. The email contains the
row's position, so no two rows can share an account, at any seed.
That's enough inside one committed file. For IDs that have to stay
unique across many generated files, see
collision-free sequences and counters.
The
.testtop-level domain is reserved, so these addresses can never reach a real inbox. - The persona sets the request mix. Two chained
getRandomBooleanchecks give roughly 45% browsers, 33% searchers and 22% buyers. At seed 7311 that came out as 89, 60 and 51 of the 200 users, counting the 8 planted buyers. - Views are skewed, searches have a long tail. 80% of product views
go to the 20 most popular products and the rest spread over the other
- Each user also has one common search term and one surname, which almost never repeats. The load testing guide linked above goes further into power-law shapes.
- Planted rows break one rule each. An unknown product, a zero quantity or an empty cart. Everything else about the user is valid, so the order is the only thing that can fail.
Rendered with seed 7311, the start of the file looks like this,
trimmed to the first user and the first planted one:
{
"seed": 7311,
"users": [
{
"id": "u0101",
"email": "[email protected]",
"password": "et agivus di",
"persona": "browse",
"views": [
"p-003",
"p-002",
"p-002",
"p-010"
],
"searches": [
"usb hub",
"snowham"
],
"order": {
"items": [
{
"productId": "p-028",
"qty": 2
}
]
},
"bad": null
},
{
"id": "u0125",
"email": "[email protected]",
"password": "quia trado feraru",
"persona": "buy",
"views": [
"p-049",
"p-011",
"p-012",
"p-011"
],
"searches": [
"usb hub",
"pelshaw"
],
"order": {
"items": [
{
"productId": "p-999",
"qty": 1
}
]
},
"bad": "unknown-product"
}
]
}
The seed key isn't part of the template. The regen script adds it
from the API response, so the file records how to rebuild itself.
Regenerating the Locust load testing data file
The regen script is the only code that talks to JsonFabrica. It sends
the raw template to
POST /v1/templates/generate, which
renders a template without saving it, and writes the pool next to the
locustfile. It's plain Python with only the standard library, so it
runs anywhere Locust does:
#!/usr/bin/env python3
"""Regenerate loadtest/users.json from scripts/users.tmpl.
Run by hand, review the diff, commit both files. Locust never calls
the JsonFabrica API; it only reads the committed JSON.
python scripts/regen_users.py # pinned seed, no diff
python scripts/regen_users.py 48213 # rebuild a logged seed
python scripts/regen_users.py random # let the API pick a seed
"""
import json
import os
import sys
import urllib.error
import urllib.request
from pathlib import Path
PINNED_SEED = 7311 # change it only when you want to replace the data
API = os.environ.get("JSONFABRICA_URL", "https://api.jsonfabrica.com")
KEY = os.environ.get("JSONFABRICA_API_KEY") or sys.exit("set the API key")
OUT = Path("loadtest/users.json")
arg = sys.argv[1] if len(sys.argv) > 1 else str(PINNED_SEED)
payload = {
"body": Path("scripts/users.tmpl").read_text(),
"params": {"groups": 8}, # 8 groups of 25 = 200 users
}
if arg != "random":
payload["seed"] = int(arg) # a typo fails here, before any request
request = urllib.request.Request(
f"{API}/v1/templates/generate",
data=json.dumps(payload).encode(),
headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
},
)
try:
with urllib.request.urlopen(request) as response:
result = json.load(response)
except urllib.error.HTTPError as err:
# 4xx/5xx carry {"error": {"code", "message", "details"}}
sys.exit(err.read().decode())
# meta.generatedAt changes on every call, so it stays out of the file.
pool = {"seed": result["meta"]["seed"], **result["data"]}
OUT.write_text(json.dumps(pool, indent=2) + "\n")
print(f"wrote {OUT}: {len(pool['users'])} users, seed {pool['seed']}")
What to know about it:
- The response is
{ data, meta }.datais the generated document, andmeta.seedis the seed that was used: either the one you sent or, withrandom, the one the API picked. - Same template, seed and params give the same file. Running the
script twice with the pinned seed produced byte-identical files. A
template edit or a different
groupsvalue changes the random draws, so commit the template and the pool together. - Run it from the repository root. The paths are relative, and
JSONFABRICA_URLonly exists so the script can point at something other than the hosted API.
Locust parameterized users: one account per simulated user
The locustfile loads the pool once per process, and each simulated user
takes the next row in on_start. That row is the user's identity for
the rest of the run:
"""Shop load test. Every simulated user is one row of users.json."""
import json
import logging
from itertools import cycle
from pathlib import Path
from locust import HttpUser, between, events, task
from locust.runners import WorkerRunner
POOL = json.loads(Path(__file__).with_name("users.json").read_text())
SEED = POOL["seed"]
rows = iter(()) # this process's share of the pool, set at test start
@events.init_command_line_parser.add_listener
def add_arguments(parser):
parser.add_argument("--pool-slices", type=int, default=1,
help="How many workers split users.json")
@events.test_start.add_listener
def take_slice(environment, **kwargs):
global rows
users = POOL["users"]
runner = environment.runner
if isinstance(runner, WorkerRunner):
index = runner.worker_index
slices = environment.parsed_options.pool_slices
# Every slices-th row from index on: disjoint across workers.
# An index past the slice count gets no rows, and its users fail.
users = users[index::slices] if index < slices else []
rows = iter(users) # the master spawns no users, so never reads it
logging.info("users.json seed %s: %d rows here", SEED, len(users))
class Shopper(HttpUser):
wait_time = between(0.5, 2)
def on_start(self):
self.row = next(rows, None)
if self.row is None:
# An exception here (not StopUser) makes Locust exit non-zero.
raise RuntimeError("users.json has no row left for this user")
res = self.client.post("/login", json={
"email": self.row["email"],
"password": self.row["password"],
})
res.raise_for_status()
token = res.json()["token"]
self.client.headers["Authorization"] = f"Bearer {token}"
self.views = cycle(self.row["views"])
self.searches = cycle(self.row["searches"])
@task
def act(self):
# The data picks the action: browse, search or buy.
getattr(self, self.row["persona"])()
def browse(self):
product = next(self.views)
self.client.get(f"/products/{product}", name="/products/[id]")
def search(self):
self.client.get("/search", params={"q": next(self.searches)},
name="/search")
def buy(self):
self.browse()
bad = self.row["bad"]
expected = 201 if bad is None else 422
name = "/orders" if bad is None else f"/orders [bad: {bad}]"
with self.client.post("/orders", json=self.row["order"],
name=name, catch_response=True) as res:
if res.status_code == expected:
res.success() # a 422 here is the planted outcome
else:
res.failure(f"{self.row['id']} (seed {SEED}): "
f"expected {expected}, got {res.status_code}")
How the pieces fit:
- One shared iterator, one row per user. Locust runs every
simulated user of a process as a gevent greenlet in one thread, so
next(rows, None)hands out each row exactly once without a lock. Thetest_starthook fillsrowsbefore any user starts. EachHttpUserhas its own client session, so the token set inon_startstays with that user. - Running out of rows fails the run. If the pool has fewer rows
than users,
on_startraises. Locust logs the error for every affected user, and in a headless run the process then exits with code 1 (checked with 205 users against the 200-row pool, both locally and with workers).StopUserwould only stop the user quietly, and the run would pass with fewer users than you asked for. - The pool isn't Locust-only. A pytest suite can load the same file to check single requests before you put load on them, as in the pytest test data guide.
- This is
HttpUser.FastHttpUsershould work with the same structure, but its client API differs in places, including how default headers are set. I didn't run it here.
The run itself is ordinary headless Locust:
locust -f loadtest/locustfile.py --headless --users 50 \
--spawn-rate 25 --run-time 30s --host http://127.0.0.1:3000
With the pinned pool, 50 users each logged in with their own account, and no session got replaced. The stats table is trimmed to the request and failure counts and the average and median in milliseconds, and long names are shortened:
Name # reqs # fails Avg Med
POST /login 50 0 38 39
POST /orders 232 0 22 22
POST /orders [bad: empty-cart] 24 0 1 1
POST /orders [bad: unknown-pr... 24 0 2 1
GET /products/[id] 878 0 4 2
GET /search 308 0 12 12
Aggregated 1516 0 10 3
The accounts have to exist before the run. The demo app reads the same
users.json at startup. In a real environment, load the pool through
whatever seeds that environment (an admin API, a seed script or a
database import), from the same commit the load test runs from. The
guide to staging environment test data
covers populating an environment at that scale.
What one shared login does
To see the first problem, change one line so that every user takes the first row instead of the next one:
self.row = POOL["users"][0] # everyone is u0101
The 50 logins all succeed, and each one replaces the session before it. The demo app counted 49 replaced sessions and 1 account in use. After that, the users' tokens are mostly dead (trimmed as above):
Name # reqs # fails
POST /login 50 0
GET /products/[id] 1193 1169 (97.99%)
The whole run also collapsed into a single persona: u0101 is a
browser, so nobody searched or bought anything. An app that allows
parallel sessions wouldn't fail this visibly. It would just share one
account's rate limit, cart and caches across every simulated user, and
the numbers would be quietly wrong instead of obviously wrong.
Letting the data pick the request mix
Shopper has a single @task, and the row decides what it does. The
mix of browse, search and buy requests follows the mix of personas in
the pool, not a weight in the code. Changing the traffic shape becomes
a template edit and a regenerated file, which shows up as a reviewable
diff. @task(3)-style weights still work for anything that should stay
fixed in code. They just aren't where the user mix lives anymore.
The per-user views and searches lists are what keep the cache
honest. To check that, change browse so that every user views the
same product, the way a hard-coded ID would:
product = "p-001"
Same 50 users, same 30 seconds. The app's cache holds 50 products, and a miss costs about 30 ms. I ran each version three times; the table is the third run, the one where the app also counted cache misses. Percentiles are in milliseconds:
GET /products/[id] views cache misses p50 p95
one hard-coded product 870 19 1 5
the user pool 888 56 1 32
The medians match, which is why this goes unnoticed. The 95th percentile was 5 to 6 ms with one product and 32 ms with the pool in all three runs, because a real spread of products keeps pushing entries out of the cache. With one product, nothing ever evicts it, so all 19 misses came from requests that arrived before the first one had finished filling the cache. The 99th percentile was similar in every run (44 to 52 ms): even the hot run's 19 misses are about 2% of its views, enough to reach the 99th percentile.
Planted bad requests under load
A load test that only sends valid requests never measures the error path, and error paths have their own costs: validation, logging, retries, rollbacks. The planted rows put a steady trickle of invalid orders into the run, and the locustfile checks that each one is actually rejected.
Two Locust features make that work:
catch_response=Truelets the code decide what counts as a failure. By default Locust marks every 4xx as failed. Here a 422 is the success case for a planted row, sores.success()overrides that, and a 201 for a planted row is marked as failed.- A separate
namegives each kind of planted request its own row in the stats. That matters for the numbers: the rejected orders in the first run took 1 to 2 ms on average, against 22 ms for real ones. Under the plain/ordersname they'd pull the average down and make checkout look faster than it is.
To show it catching something, give the app a bug: accept orders with
a quantity of 0. At 100 users, the run reaches the zero-qty row
u0425, which now gets a 201:
Name # reqs # fails
POST /orders 540 0
POST /orders [bad: empty-cart] 25 0
POST /orders [bad: unknown-pr... 51 0
POST /orders [bad: zero-qty] 21 21 (100.00%)
Aggregated 3023 21 (0.69%)
Error report
21 POST /orders [bad: zero-qty]: u0425 (seed 7311):
expected 422, got 201
The error report is wrapped to fit. Locust exits with code 1 when any
request failed, so a CI job fails too. The failure message names the
user row and the pool seed, which together with the same commit of
scripts/users.tmpl is everything needed to rebuild the same data
later. The flip side is that the error report gets one entry
per user that fails. That's fine for a handful of planted rows. For
failures that hit hundreds of users, a message without the ID groups
better.
Splitting the pool across distributed workers
In a distributed run, each worker is a separate Locust process with
its own copy of POOL and its own rows iterator. Without a split,
every worker starts at row 0. To show what that does, take out the
slicing and let every process read the whole pool:
rows = iter(POOL["users"]) # every process starts at row 0
With --processes 2 and 100 users, each worker ran 50 users from the
same first 50 rows. The app saw 100 logins for 50 accounts, with 50
sessions replaced, and the requests failed accordingly:
Name # reqs # fails
POST /login 100 0
GET /products/[id] 1690 840 (49.70%)
GET /search 605 303 (50.08%)
Aggregated 2927 1419 (48.48%)
The locustfile above prevents that with worker_index. Each worker
has an index, starting at 0, which the master hands out as workers
connect. WorkerRunner.worker_index was added in Locust 2.11. A
worker has no attribute for the total number of workers (only the
master tracks that), so the slice count is a custom argument,
--pool-slices. Custom arguments are forwarded
to workers when the run starts, which is why the slicing happens in
test_start and not at import time. Each worker then takes every
second row (with two slices) starting at its own index, so the slices
can't overlap.
On one machine, --processes starts a master and the given number of
workers. It relies on fork(), so it doesn't work on Windows:
locust -f loadtest/locustfile.py --headless --users 100 \
--spawn-rate 25 --run-time 30s --host http://127.0.0.1:3000 \
--processes 2 --pool-slices 2
Across machines, start the workers with --worker and the master with
--expect-workers, which a headless master should get so it waits for
all of them before starting:
# on each load generator (here: 10.0.0.5 is the master)
locust -f loadtest/locustfile.py --worker --master-host 10.0.0.5
# on the master
locust -f loadtest/locustfile.py --master --headless \
--expect-workers 2 --pool-slices 2 --users 100 \
--spawn-rate 25 --run-time 30s --host https://shop.staging.example
The master forwards --host to every worker, so it has to be an
address the workers can reach, not 127.0.0.1. Keep --pool-slices
equal to --expect-workers.
I ran both forms on one machine, the second with the workers on
localhost instead of --master-host. Both times, the app saw 100
logins for 100 different accounts and no replaced sessions, and each
worker logged its share. The --processes run printed this, trimmed
to the message:
users.json seed 7311: 200 rows here
users.json seed 7311: 100 rows here
users.json seed 7311: 100 rows here
The first line is the master, which spawns no users. Things to watch:
- Every worker needs the same file. The split assumes identical rows on every machine. Each worker logs the seed, so a seed mismatch is visible in the logs. A template edit at the same seed isn't, so deploy the same commit everywhere.
- Forgetting
--pool-slicesfails the run. With--processes 2and the default of 1 slice, worker 0 took all 200 rows and worker 1 took none (0 rows here). Worker 1's 50 users then raised inon_start, and the master exited with code 1. - Restarted workers get new indexes. In Locust 2.47's source, the master gives every new worker ID the next unused index, and a restarted worker process comes back with a new ID. The guard turns an index past the slice count into an empty slice, so the run fails instead of quietly duplicating rows. Restart the whole run instead.
- The pool must be big enough. Each worker gets about
rows ÷ slices rows and needs one per user it runs. Raise
groupsin the regen script if the user count grows.
Reproducing a bad run from the pool's seed
The seed in users.json belongs to the data, not to Locust. It
reproduces which users exist and what each one sends. It doesn't
reproduce timing: wait times, request interleaving and the order in
which users start differ on every run.
For everyday runs, the committed pool with the pinned seed is the
point: every run sends the same data, so a change in the numbers
comes from the system, not the data. A scheduled job can additionally
regenerate the pool with random before each run, without committing
it, to cover more combinations. That turned out to matter here. With
the quantity bug still in the app, the pinned pool at 50 users passed:
its first 50 rows only contain unknown-product and empty-cart
rows. The random seed put a zero-qty row at u0125:
users.json seed 925837258: 200 rows here
24 POST /orders [bad: zero-qty]: u0125 (seed 925837258):
expected 422, got 201
The seed is in the log and in the failure message, so rebuilding the
exact pool from the same commit of scripts/users.tmpl takes one
command, followed by a reseed of the environment
from the new file and the same Locust command:
python scripts/regen_users.py 925837258
Regenerating with that seed produced a byte-identical file. The same idea for unit tests, logging a seed and replaying it, is covered in replaying a failure from its seed.
If a run has to exercise every kind of planted error regardless of
seed, as long as the run has at least 25 users, plant them by position
instead of picking them randomly: unknown-product at j == 23,
zero-qty at j == 24 and empty-cart at j == 25. The bad
variable then goes away: order and the bad field switch to the position, and
persona forces buy from position 23 on, so all three planted orders
actually get sent:
"persona": <if(getVar('j') >= 23)>"buy"
<elseIf(getRandomBoolean(0.45))>"browse"
<elseIf(getRandomBoolean(0.6))>"search"
<else>"buy"<endIf>,
...
"order": <if(getVar('j') < 23)>{ "items": [{
"productId": "p-<appendBefore('0', getRandomNumber(1, 500), 3)>",
"qty": <getRandomNumber(1, 3)> }] }
<elseIf(getVar('j') == 23)>
{ "items": [{ "productId": "p-999", "qty": 1 }] }
<elseIf(getVar('j') == 24)>
{ "items": [{ "productId": "p-007", "qty": 0 }] }
<else>{ "items": [] }<endIf>,
"bad": <if(getVar('j') == 23)>"unknown-product"
<elseIf(getVar('j') == 24)>"zero-qty"
<elseIf(getVar('j') == 25)>"empty-cart"<else>null<endIf>
Rendered at two different seeds, both files had u0123, u0124 and
u0125 as the three planted rows, and 24 planted rows in total. The
pool then spends three of every 25 users on error paths.
FAQ
How do I use test data from a file in a Locust test?
Load the file once per process, at module level in the locustfile or in
a test_start event listener, and hand each simulated user its own row
in on_start. Keep the file in the repository next to the locustfile
so every machine that runs the test reads the same data. A locustfile
is an ordinary Python module, so json.load and a shared iterator are
all it takes.
How do I give each Locust user a different login?
Give every simulated user its own account. Keep a pool of credentials
with at least as many rows as users, take the next row in on_start,
log in with it, and store the token on that user's client. Each
HttpUser has its own session, so the token and cookies stay with that
user. If every user logs in with the same account, per-account
sessions, rate limits and caches end up shared, and the test measures
something production never does.
How do I stop Locust workers from using the same test data?
Split the pool by worker index. In Locust 2.11 and later, a worker's
environment.runner.worker_index gives its position, starting at 0,
and a custom command-line argument holds the number of slices; custom
arguments are forwarded to workers when the run starts. Each worker
takes every Nth row starting at its index, so no two workers share a
row. Without a split, every worker starts at the top of the same file.
Can Locust tasks be weighted by test data instead of @task weights?
Yes. Use a single task that reads a field from the user's own row, such
as a persona, and calls the matching method. The request mix then
follows the data: if a fifth of the rows are buyers, roughly a fifth of
the users buy. @task weights still work as usual for anything that
should stay fixed in code.
How do I test expected error responses in Locust without counting them as failures?
Make the request with catch_response=True inside a with block,
compare the status code with the one you expect, and call
response.success() or response.failure() yourself. Without that,
Locust counts every 4xx as a failure. Give expected-error requests
their own name argument so their latency and counts show up as
separate rows instead of mixing into the happy path.
Is there a JsonFabrica Locust plugin or Python package?
No. JsonFabrica is a plain JSON-over-HTTP API, with no Locust plugin, Python package or database connector. You write a short regen script that sends a template and a seed to the API and writes the generated JSON file into your repository. Your own locustfile loads that committed file, and the load test never calls JsonFabrica.
A committed, seeded pool gives every simulated Locust user its own account, its own requests and, now and then, a request that's supposed to fail, and the logged seed makes any run's data rebuildable. Rendering the pool is one call to the JsonFabrica API with a raw template, a seed and params, documented in the templates API reference.
Generate realistic test data with JsonFabrica
Describe the shape of your data once, then generate as many fresh, realistic JSON documents as you need via a simple API call.