r/devops • u/Ok_Class2432 • Oct 21 '26
Tools How do you simulate realistic user traffic in load testing?
We are looking to overhaul our load testing, since our current script only slams 10k users in 60 seconds and gives us garbage data. It exhausts connection pools and creates artificial bottlenecks that would not show under any kind of normal use case.
Real users ramp up slowly, and idle on pages, and don't jump from one to another without a second thought, they do not fire off database transactions with zero pause.
We should be reflecting real behavior, not inducing cold start failures.
Has anyone modeled this at scale? Should we make the step curves with warm up times to let caches and other systems warm up before hitting the expected load? We want to reflect real user behaviour, not just trigger cold start failures.
20
u/Prudent_Design_9782 Oct 21 '26
You definitely need to set up curves. Going from 0 to 10k instantly does not test your app, it just tests how fast things break under a massive spike, and it is useful, but not really a concern, except if you are making the next big social network. We usually do a warm up at a fraction of the load to get caches populated and pods spun up[ before hitting the final target.
26
u/mrswats Oct 21 '26
Try using something like k6
23
u/reallydontaskme Oct 21 '26
We release it to prod, no better load testing environment /s
7
u/SadFaceSmith Platform Security Engineer Oct 21 '26
https://k6.io/
3
u/Abe_Bazouie Oct 21 '26
The first thing I’d change is stop modeling the test around “10k users” and start modeling it around what production actually does.
I usually want to know:
what does normal requests/sec look like?
what does peak look like?
what percentage of traffic hits each endpoint?
how long do users actually pause between actions?
how long do sessions live?
what does concurrency look like during a real peak?
Then build a few realistic user journeys around that instead of having every virtual user hammer the same path as fast as possible.
I’d also separate different tests.
A steady-state/load test should usually have a warm-up period so caches, connection pools, JIT, autoscaling, etc. can settle before you start measuring.
But cold-start behavior is still worth testing. I’d just test it separately instead of accidentally turning every load test into a cold-start test.
Same with stress testing. If I intentionally want to find the breaking point, then sure, ramp aggressively. But that answers a different question from “can we handle Tuesday afternoon traffic?”
If you have production telemetry, that’s gold. Build the traffic mix from real request distributions rather than guessing.
And watch more than latency. I’d be looking at DB connections, pool saturation, queue depth, CPU, memory, errors, retries, autoscaling behavior, and downstream dependencies.
One other thing: if your tool supports arrival-rate style testing, I prefer that for a lot of these scenarios. It lets you say “send roughly X requests/second” instead of coupling traffic generation to how fast the system responds.
Otherwise once the app slows down, your load generator can accidentally back off and make the system look healthier than it really is.
4
u/Duente_Zaibatsu Oct 21 '26
I used Gatling, it was free, we could create sustainable scenarios, like ramp up, ramp down, random and burst, that was reliable and computationaly cheap to emulate.
We used to test warm up, parallel start-up and cache and queue reliability.
I do not recall details, but our ramp was something like 0 - 2k - 500k in 1 minute intervals, and we had a producer / consumer / API pattern.
If I recall correctly, 150k Users per minute was our production expected usage at the average, and 250k at the peak.
It was expensive to test due to server costs, so we ran it about once a month for UAT and TOS validations
2
u/sp_dev_guy Oct 21 '26
Mirror traffic is lowest effort assuming you have 24hr traffic or dont need to be doing the stress tests at weird hours. Otherwise you need to analyze/capture your traffic footprint & rebuild it
1
u/kdotp5 Oct 21 '26
ramp/warmup helps but the real issue is you’re running a closed model. 10k VUs looping as fast as they can means your request rate is set by how slow your server is, which is backwards. real traffic is an arrival rate, people show up whether you’re slow or not
grab a day of prod logs and look at what sessions actually do. which flows, how many requests, gaps between them. think time is super long tailed irl, not sleep(2)
ramp over 10-15 min, hold steady 30+ min, only measure the steady part. still do one test where you slam it on purpose so you know where it falls over
k6 ramping-arrival-rate or gatling open injection both handle this out of the box
1
u/bezcurhq Oct 21 '26
One thing to check alongside the curve is the executor. ramping-vus is a closed model: a VU only starts its next iteration when the last one finishes, so once the system slows down the test quietly sends less load (k6's docs call this coordinated omission). ramping-arrival-rate starts new iterations at the rate you set no matter how slow responses get, which is closer to real users who show up independently. Keep the randomized sleeps inside each iteration as the think time.
1
u/JungleCatHank Oct 21 '26
Locust is good for this. It scales up users at a configurable rate so you can see where things start to bog down. You can also script requests in python to simulate user activity.
1
u/mralex215 Oct 21 '26
-1
u/singh_abinashi Oct 21 '26
Your instinct is right: the 10k in 60 seconds script is testing your cold start behavior, not your capacity.
Real traffic ramps, pauses, and reuses warm state, so a test that skips all three measures a system your users never meet.
What worked for me as a shape: ramp in steps, hold each step long enough for caches and pools to reach steady state, and only then judge the numbers at that level.
The hold matters as much as the ramp.
A cache that looks fine at minute one of a step can be evicting hard by minute ten, and a pool that survives the jump can still leak connections slowly under held load.
Give each virtual user a think time distribution, not a fixed delay.
Zero pause traffic turns your test clients into a DDoS tool and produces the pool exhaustion you are seeing, because no real user fires the next transaction the instant the last one returns.
One more thing to separate: keep a cold start test, but label it as one.
Knowing how the system behaves from cold is useful.
It just should not be the run you tune capacity from.