How to simulate thousands of users for load testing

Diego Salinas
Enterprise Content Manager
Gatling
Table of contents
Add to Google preferred sources

Summarize this article with AI

To simulate thousands of users, you don't open thousands of browsers. You run thousands of lightweight virtual users (VUs) from a load testing tool. Each VU replays a scripted user journey at the protocol level, with its own session, test data and think time.

The process: script the journey as code, convert your production traffic into an arrival rate with Little's Law, choose an open or closed workload model, ramp up to a steady state, and spread the load across several load generators once one machine saturates. Then judge the run on p95/p99 response time, error rate and throughput, not on the user count.

On an async engine like Gatling's, a single load generator can sustain up to 60,000 concurrent VUs or 300,000 requests per second, depending on the protocol and scenario. Benchmark your own scenario before relying on any per-machine number.

The hard part isn't generating thousands of users. It's making those users behave like real ones.

Key takeaway What you need to know
Thousands of users don't require thousands of browsers Protocol-level virtual users simulate real traffic without rendering pages. Async engines can run thousands on one machine
Size your test using real traffic Use Little's Law: concurrent users = arrival rate × average session duration. Add peak traffic and headroom
Choose the right workload model Open models maintain user arrivals even when responses slow. Closed models maintain a fixed user population
Realistic behavior matters more than user count Use representative journeys, unique test data, think time, and realistic traffic distribution
Scale load generators before they become bottlenecks Monitor CPU, memory, network, and sockets. Use distributed generators when one machine reaches its limits
Measure performance, not just concurrency Evaluate p95/p99 response times, error rates, throughput, and SLO compliance. Automate assertions to detect regressions

What "thousands of users" actually means

A virtual user is a scripted session that sends the same traffic a real client would: HTTP, WebSocket, gRPC or MQTT requests, with its own cookies, tokens and pauses. It doesn't render pages or run front-end JavaScript, which is why one machine can carry thousands of them.

"10,000 users" is ambiguous. It can mean four different loads:

Metric Meaning Example
Concurrent users Sessions active at the same instant 10,000 people online at once
Arrival rate New sessions starting per second 50 new users/s
Throughput Requests the system processes per second 1,500 requests/s
Response time How long each request takes p95 of 400 ms

Simulating 10,000 concurrent users is not the same as sending 10,000 requests per second, or serving 10,000 visitors a day.

Size the test with Little's Law

Little's Law links arrival rate and concurrency:

Concurrent users = arrival rate (users/s) × average session duration (s)

Example: your analytics show 50 new sessions per second at peak, and a session lasts 240 seconds. That's 50 × 240 = 12,000 concurrent users. If each session makes 30 requests, you need 50 × 30 = 1,500 requests/s on average.

Then add a peak factor for launches and sales (often 2 to 5× the daily average) plus headroom. Note what happens if the system slows down: sessions get longer, so concurrency climbs even when arrivals stay the same. That's exactly the effect your test needs to capture.

Open vs closed workload models

The workload model decides how load reacts when your system slows down, and it matters more than the VU count.

Model How load is generated Use it for Risk
Open New users arrive on a schedule (e.g. 200/s), whatever the response time Public websites, APIs, e-commerce, ticketing Can overwhelm a system fast; needs ramps and stop criteria
Closed A fixed pool of users; a new iteration starts only when one finishes Capped populations: call centers, internal apps, admission queues Load drops exactly when the system struggles

The closed model's blind spot has a name: coordinated omission. When the system slows, the load generator waits with it, sends fewer requests, and never records the delay real users would have felt. In a ScyllaDB benchmark, a closed-model run reported a p99 of about 249 µs. The latency-corrected open-model p99 was about 665 ms.

Rule of thumb: if real users don't wait for each other before showing up, use an open model. Gatling makes you choose explicitly with injectOpen and injectClosed, and refuses to mix the two in one injection chain (Gatling docs).

How to simulate thousands of users, step by step

The examples use Gatling's Java SDK. The same DSL exists in JavaScript, TypeScript, Kotlin and Scala.

1. Pick the journeys that matter

Start from production analytics, not a round number. Choose the business-critical flows and their mix, for example 70% browse, 20% search, 10% checkout. Write SLOs per journey before you write code: checkout p95 under 800 ms, errors under 0.5%.

2. Script the journey with realistic data

Each virtual user needs its own account, token and product IDs. Reusing one user gives you near 100% cache hits and flattering numbers. Correlate dynamic values (session IDs, CSRF and OAuth tokens) and add checks so a 200 error page isn't counted as a success.

ScenarioBuilder checkout = scenario("Checkout")
    .feed(csv("users.csv").queue())                  // one unique record per VU
    .exec(http("Login").post("/login")
        .formParam("user", "#{username}")
        .check(jsonPath("$.token").saveAs("token"))) // correlation
    .pause(1, 3)                                     // think time
    .exec(http("Buy").post("/cart/checkout")
        .header("Authorization", "Bearer #{token}")
        .check(status().is(200)));

Watch the feeder strategy. queue uses each record once, so 10,000 users and 2,000 accounts will exhaust the file. random never runs out but lets users share credentials. Size your data file to the test.

3. Define the load profile

Translate your Little's Law numbers into an injection profile: warm-up, ramp, steady state, then ramp-down. For a public app, use an open model:

setUp(
    checkout.injectOpen(
        rampUsersPerSec(10).to(50).during(300), // 5 min ramp to 50 arrivals/s
        constantUsersPerSec(50).during(1200)    // 20 min steady state
    )
)
.protocols(httpProtocol)
.assertions(
    global().responseTime().percentile(95.0).lt(800),
    global().failedRequests().percent().lt(0.5)
);

At 50 arrivals/s and 240 s sessions, this settles around 12,000 concurrent users. If your goal is a fixed population instead, switch to a closed model:

checkout.injectClosed(
    rampConcurrentUsers(0).to(10000).during(300),
    constantConcurrentUsers(10000).during(600)
);

This ramps to 10,000 concurrent users over five minutes and holds them for ten. Same headline number, very different behavior when the system slows.

4. Check the load generator first

Run a smoke test with a handful of users, then a small ramp while watching the generator's CPU, memory, network and GC. A saturated generator adds its own latency and caps throughput, so you end up measuring your test rig. Scale out before it saturates (next section).

5. Watch the system under test

Correlate test metrics with server-side telemetry from your APM or OpenTelemetry stack: CPU, memory, DB connection pools, queue depth, GC pauses, autoscaling events. Load test numbers tell you something broke. APM metrics tell you what.

6. Read percentiles and find the breaking point

Look at p50, p95, p99 and max, plus throughput and errors over time. Then push past your target in steps to see where SLOs fail and how the system degrades and recovers.

7. Automate it

Assertions turn the simulation into a pass/fail gate. Run it in CI/CD on every release and compare against a baseline, so regressions surface in a pipeline instead of an incident.

Scaling past one machine

How many machines you need depends mostly on how your tool maps virtual users to compute.

Thread-per-user tools (JMeter, LoadRunner) give every VU an OS thread. A VU waiting for a response or sitting in a pause still holds that thread and its memory, so CPU and RAM run out long before the network does.

Async, event-driven engines (Gatling, k6, Artillery) treat a VU as lightweight state. Gatling's engine is built on Netty: a waiting VU holds no thread, and a small thread pool serves all of them. It's also engineered around the physical limits of a load generator:

  • About 64,000 sockets per local IP to one target: non-blocking I/O uses every available socket
  • About 60 s TIME_WAIT before Linux reuses a closed port: persistent connections avoid burning through ports
  • CPU-heavy TLS handshakes: BoringSSL and session reuse cut that cost

The result: up to 60,000 concurrent VUs or 300,000 requests/s on a single generator, depending on protocol and scenario. Cryptography in your own script (JWT signing, HMAC, mutual TLS) eats into that, so measure.

When you need distributed load

Scale out when a smoke-tested generator approaches CPU or network saturation, when you need traffic from several regions, or when the target sits behind a firewall. Gatling Community Edition runs on any machine you provision. Gatling Enterprise Edition adds distributed execution:

  • Managed load generators: 10+ regions, with traffic weighted by region (for example 70% US, 30% EU) and optional dedicated IPs to allowlist in your WAF
  • Private locations: generators run in your AWS, Azure, GCP, Kubernetes, OpenShift or on-prem environment, next to the system under test; the agent connects outbound to Gatling, so no inbound firewall rules are needed
  • Automatic sharding: you write one injection profile, and Gatling splits it across generators and aggregates results into one report

For scale reference, Enterprise customers run 5M+ concurrent VUs on 20 load generators. Most teams need far less: the point is to add generators when the test requires it, not to maintain a fleet.

{{cta}}

Common pitfalls

A wrong model gives confident, wrong numbers. These are the mistakes that distort large tests more than tool choice does.

Pitfall What goes wrong Fix
No think time VUs fire requests every few milliseconds and generate far more RPS than real users Add realistic pauses and pacing from analytics
Shared test accounts Same user or product every time means ~100% cache hits Feed unique, varied data; report the cache hit ratio
Saturated load generator The injector's CPU, sockets or TLS work become the bottleneck Monitor generator health; scale out early
Undersized staging Smaller databases and fewer nodes produce misleading results Match production topology and data volume, or test production with guardrails
CDN, WAF, DDoS protection Heavy traffic from a few IPs gets blocked; you test a block page Notify providers, allowlist dedicated IPs, distribute across regions
Third-party services Payment, SMS or identity providers rate-limit, bill or ban you Stub them (e.g. WireMock) or agree a test window
Cold starts JIT, caches and autoscaling skew the first minutes Run a warm-up phase and exclude it from SLO checks
Unsafe production runs A test causes a real outage or pollutes real data Stop criteria, off-peak windows, synthetic accounts, a kill switch
Expecting browser metrics Protocol-level VUs don't render pages or run JavaScript Pair with Playwright, synthetic monitoring or RUM for front-end performance

Reading the results

Reaching 10,000 users proves nothing on its own. Two hypothetical runs, same VU count:

Test ATest BVirtual users10,00010,000p95 response time350 ms3,800 msFailed requests0.2%8%Throughput4,000 req/s1,200 req/sVerdict (p95 < 500 ms, errors < 1%)PassFail

Both could be reported as "we tested 10,000 users." Only one system is ready. Judge every run on these performance testing metrics:

  • Response time percentiles (p50, p95, p99): averages hide the slow tail your unhappiest users feel
  • Throughput achieved vs target: if requests/s plateaus while users keep rising, requests are queueing
  • Error rate and type: 5xx, timeouts and 429s each point to a different bottleneck; declare expected statuses so a planned rate limit isn't counted as failure
  • Active users over time: in an open model, a climbing curve at constant arrivals means sessions are getting slower
  • Server resources: CPU, memory, DB pool, GC and queue depth show the cause behind the symptom
  • Generator health: proof the test itself is trustworthy

For AI and LLM-backed endpoints, also track time to first token, tokens per second and cost per run.

Tools that can simulate thousands of users

Every tool below can reach thousands of users. They differ in scripting language, concurrency model and whether distributed execution is free.

Tool License Scripting Concurrency model Distributed execution Strong fit
Gatling Community: Apache 2.0; Enterprise: commercial Java, Kotlin, Scala, JavaScript, TypeScript; recorder and no-code builder Async, non-blocking (Netty) Enterprise: managed regions or private locations High-scale, CI/CD-driven tests owned by dev and QA
Apache JMeter Apache 2.0 GUI and XML test plans; Groovy Thread per user Free controller/worker mode, manual to operate Broad protocol and plugin coverage, GUI-first teams
Grafana k6 AGPL-3.0 JavaScript, TypeScript Go runtime, goroutines Grafana Cloud k6 or custom orchestration JS teams in the Grafana ecosystem; hybrid browser tests
Locust MIT Python gevent greenlets Free master/worker Python teams, custom logic
Artillery Open source + cloud YAML + JavaScript Node.js event loop AWS Lambda/Fargate Node teams, Playwright reuse
OpenText LoadRunner Commercial C, JavaScript, Java (VuGen) Process or thread per VU Controller + load generators Legacy enterprise protocols such as SAP and Citrix

How to choose: match the language your team already writes, check protocol coverage (gRPC, WebSocket, MQTT, Kafka), check whether scale-out is free or paid, and benchmark your own scenario on one generator before trusting any vendor's VUs-per-machine figure, including ours. For deeper comparisons, see JMeter alternatives and Gatling vs k6.

Who needs to simulate thousands of users

Large-scale load testing pays off where traffic spikes at predictable moments, like Black Friday, and where failure has a direct revenue, legal or safety cost.

Industry Peak trigger What's at stake
E-commerce and retail Black Friday, flash sales, product drops Checkout, inventory locks, payment gateways. US online spend hit about $12.5M per minute at the 2025 Black Friday peak (LogicMonitor)
Ticketing and live events On-sales, presales Queues, seat inventory, bots. Ticketmaster's 2022 Eras Tour presale saw 3.5B system requests, about 4× its previous peak (MBW)
Banking and payments Payday, tax season, new payment methods Authorization and core banking. EU DORA, in force since 17 January 2025, lists performance testing in its ICT testing programme (Art. 25)
Media and streaming Live matches, finales Login, entitlement, playback APIs; seconds of downtime are public
Telecom and IoT Device fleet reconnects, launches Session setup, TLS handshakes, MQTT brokers
Government Tax deadlines, enrollment windows Citizen access. HealthCare.gov was tested at about 1,100 simultaneous users against 60,000 expected, then failed at launch in October 2013 (Nextgov)
Travel Fare sales, disruption re-bookings Search, availability and booking APIs
SaaS and AI products Launches, viral growth, LLM features Noisy neighbors, token rate limits, cost per request

What teams reach with Gatling

Customer Sector Result
JioStar Streaming (IPL cricket) Supports 30M concurrent users, with +15M concurrent users within 90 seconds
TUI Travel Over 100,000 req/s across 87 simulations; p95 cut from up to 10 to 20 s to under 1 s
Bouygues Telecom Telecom Up to 100,000 concurrent requests and peaks of 22 Gbps
LoginRadius Identity (CIAM) Latency cut from 500 ms to 250 ms after migrating from JMeter; 80%+ fewer production issues

Start with one realistic test

Simulating thousands of users is easy. Simulating them accurately takes the right workload model, realistic data, a healthy load generator and SLO-based pass/fail criteria. Start with one critical journey, size it with Little's Law, and grow from there.

About the author
‍
Diego Salinas
Gatling

Diego Salinas Gardón is a senior technical copywriter and content strategist specializing in performance testing, developer tools, SaaS, and software infrastructure. With hands-on experience infront-end development, testing, and modern web technologies.

‍

He currently works at Gatling, where he creates content that helps developers and engineering teams better understand performance, testing, and DevOps.

FAQ

How many virtual users do I need for a load test?

Multiply your peak arrival rate (new sessions per second) by the average session duration in seconds. 50 sessions/s × 240 s = 12,000 concurrent users. Then add a peak factor and headroom.

Can one machine simulate 10,000 users?

Usually, with an async engine. Gatling can sustain up to 60,000 concurrent VUs or 300,000 requests/s per load generator, depending on protocol and scenario. Thread-per-user tools typically need several machines for the same load.

Is 10,000 concurrent users the same as 10,000 requests per second?

No. Concurrency counts active sessions; throughput counts requests. 10,000 users with realistic think time might generate 1,000 to 2,000 requests/s.

Should I use an open or closed workload model?

Open for public websites and APIs, where new users keep arriving regardless of response time. Closed only when real concurrency is capped, such as a call center or an admission queue.

Ready to move beyond local tests?

Start building a performance strategy that scales with your business.

Need technical references and tutorials?

Minimal features, for local use only