Load Testing Enterprise Systems: Realistic Scenarios with k6 and JMeter

The answer to "How many users can the system handle?" comes from measurement, not guesswork. I repeat this sentence at the office so often that the team now finishes it in chorus before I can. But there's a painful memory behind it: a few years ago, one of our clients, despite our warnings, said of load testing, "no need, the server is powerful." The TV ad aired, traffic jumped 40-fold within minutes, the database connection pool filled up, and the site went down at the sweetest hour of the campaign. The ad budget flowed straight into the error page on screen.

Since that day, load testing has been non-negotiable on our projects. In this post I'll describe our approach, our tool choices and what we've learned in the field.

How we choose between k6 and JMeter

We've been actively using both tools for years, and both have a long track record with us.

k6 is a modern tool where you write scenarios in JavaScript and run them from the command line. It's our first choice for developer teams, because the scenario file is versioned like code, goes through code review and fits naturally into the CI pipeline. You can set up a "run a smoke load test every night at 02:00, break the pipeline if p95 exceeds this threshold" routine with k6 in half a day.

JMeter, on the other hand, is the veteran of this field. Its GUI is more approachable for beginners, and its protocol support is still unmatched: when we need to put load directly on a database via JDBC, test JMS queues or run FTP scenarios, we turn to JMeter. It has one more advantage in enterprise environments: many organizations' test teams already know JMeter, and its standard report formats have already passed audits.

Our rule of thumb: k6 for API-focused, developer-centric work; JMeter when you need mixed protocols, ready-made reporting and a GUI. Sometimes we use both on the same project — one stands guard in CI, the other takes the field for the big drills.

k6 is preferred for API-focused, developer-centric work; JMeter for mixed protocols, ready-made reporting and GUI needs.
k6 for API work, JMeter for mixed protocols; sometimes both together.

Where tests lie the most: scenario realism

There's something far more important than which tool you use: how closely the scenario resembles real life. We've seen it so many times — the team fires a thousand requests per second at a single endpoint, a report gets written saying "the system can handle it," and then everything collapses under real traffic.

Real users don't hammer a single endpoint. They log in, browse, search, pause to think, add to cart, change their minds, come back. Those pauses in between are called "think time," and when they're stripped out of the scenario, the test paints an optimistic picture that doesn't exist in reality. Because the number of concurrent sessions, memory usage and session store load are all shaped by that waiting pattern.

The second requirement is a gradual load profile. We use a four-phase profile: a slowly rising ramp-up, a long plateau at constant load, a sudden spike and a soak (endurance) phase lasting hours. Each phase exposes a different disease — a spike catches autoscaling delays; a soak catches memory leaks. On one logistics client's system, everything was spotless in a two-hour test; in an eight-hour soak test, the memory leak revealed itself. In production, this had been showing up as "we restart it every night, we don't know why."

The load profile consists of four phases: ramp-up, plateau, spike and soak; each phase exposes a different problem.
Each phase exposes a different disease.

The third requirement is production-like data. A test run against a table with a hundred records doesn't represent a reality of ten million records; query plans behave completely differently. An anonymized production copy or synthetic data of the same volume — one of the two is a must.

Let me add a fourth requirement, one that's often skipped: the test environment has to resemble production. A test run on a server with half the CPU of production makes the results usable only after "interpretation," and interpretation is the enemy of measurement. The same goes for cache and CDN layers: a first run with a cold cache doesn't show the performance of a warmed-up system — in every drill we run a warm-up round first and only then start measuring. The load generator itself becoming the bottleneck is another classic trap; trying to generate a hundred thousand virtual users from a single machine and not realizing you're actually testing your own laptop is a story that has really happened (not to us, thankfully, but we witnessed it up close).

Why the average response time lies

The test ran and the report came in: "average response time 180 ms." Sounds nice, doesn't it?

It shouldn't. An average also makes "reasonable" a system where 950 out of a thousand users wait 100 ms and 50 wait 8 seconds. That's why we almost never talk about the average; we look at the p95 and p99 percentiles. p95 is the time within which 95 percent of users get a response — your unhappiest 5 percent live beyond it, and they're usually the ones who post on social media.

Alongside the percentiles, we read three things together: error rate (500s that quietly climb under load), saturation (CPU, memory, connection pool, disk — which one fills up first?) and throughput. These four are meaningful together; none of them tells the story on its own. The point of the test isn't a "pass/fail" stamp anyway; it's to learn where the system will break first. A team that knows its breaking point makes plans on campaign morning instead of panicking.

Four indicators for load test results: p95 and p99, error rate, saturation and throughput.
None of them tells the story on its own.

Speaking of breaking points, let me also tell you where most of the ones we've found turned up: the database connection pool, slow queries and external service calls. Scaling the application server is easy; but if there's a single database behind it and the pool is capped at 50 connections, doubling the number of servers in front only makes the queue longer. At one client, we saw a single slow report query occupy the entire pool under load and slow down even unrelated pages — the fix was an index on that query and moving the report job to a queue, not bigger servers. That's exactly what load testing gives you: where you should spend your money.

Testing once is like never testing

The last and, in my view, most important point: load testing is not an event, it's a process. You tested the system today, great; an innocent-looking report page added three months from now may have changed everything with an N+1 query nobody noticed. We run tests before every major release, and on critical systems we wire a light load scenario into CI — a performance regression announces itself through a pipeline alert, not a customer complaint.

Performance isn't a feature, it's a process. (Another one of the sentences the office finishes in chorus.)

One last piece of advice, on reporting: don't present test results to management with a p95 chart; nobody will care. Say something like: "The current infrastructure can handle this much of the concurrent users in your campaign target; reaching the target requires these two improvements, and they cost this much." The moment you translate technical measurement into business language, load testing turns from a budget line into an insurance policy — and nobody ever asks "do we really need this?" again. Remember that site that went down with the TV ad? The following year it ran the same campaign on a system that had been tested in advance, without a single outage. The same client, two years apart, two very different mornings.

If your campaign season is approaching, or if you don't really know the answer to "how many users can our system handle," drop us a line — let's plan together how to design a realistic load drill without touching your current system. You can't know without measuring; but measuring is far more achievable than people think.