Before going live, the new server environment of a high-traffic corporate website was put through a systematic load test with JMeter. The question was simple: "What happens if thousands of people hit the site at the same time during a busy period or a major announcement?" This post walks through the problem definition, the methods we tried, and, most importantly, what the numbers actually told us. All organization, address, and personal details have been anonymized.
A new server environment had been prepared, but whether it could handle peak traffic was unknown. The question was clear: Up to how many concurrent users does the system run healthily, at what point does it start to crack, and where exactly is the bottleneck?
Learning the answer in production, with real users, is the most expensive route. So instead we generated the load in a controlled way, inside an isolated test environment that was an exact replica of production. The work was carried out over a summer morning, in sessions of a few hours each.
Test tool: Apache JMeter 5.6.3
Hardware: 16 vCPU / 32 GB RAM
Target load: 4,000 concurrent virtual users
Ramp-up: 240 seconds
In other words, we climb from 0 to 4,000 users over four minutes and watch where in that climb the system cracks.
A load test is only as valuable as its imitation of a real user. Hammering the homepage alone is easy but misleading. So we modeled a typical visitor journey:
With random search terms and reasonable think-times, the scenario was brought behaviorally close to a real user. These five steps spread the load across three distinct layers: the web server (Apache) serving static content, the application layer rendering dynamic pages, and the database running the search/listing queries.
The first runs, on the untuned environment, were grim. One of the early runs looked like this:
| Metric | Value |
|---|---|
| Average response time | ~105 seconds |
| Error rate | 49.8% |
| Slowest request | ~289 seconds |
An average response time north of a hundred seconds and one in every two requests failing; this is exactly the "the site is up but unusable" state. The good news: this is precisely what a load test is for, to trigger that collapse in a controlled environment before any real user experiences it in production. From here on, it was a matter of chasing the problem layer by layer.
Most of the bottleneck sat in the web server layer. Apache's MPM (Multi-Processing Module) settings, including how many workers to start, how many to keep spare, and how many requests to serve at once, directly determine how many people the system can carry simultaneously. A total of 8 different configurations were tried.
We evaluated the configurations against four metrics:
The configurations are given anonymously, labeled A-H:
| Config | Start | MinSpare | MaxSpare | ServerLimit | MaxReqWorkers | MaxConn/Child | First Error ↑ | Stop ↑ | Error % ↓ | RAM (GB) |
|---|---|---|---|---|---|---|---|---|---|---|
| A (current) | 50 | 0 | 50 | 100 | 4000 | 0 | 2800 | 3800 | 10% | 30 |
| B | 20 | 0 | 100 | 20000 | 8000 | 10000 | 2000 | 3000 | 50% | 10 |
| C | 4 | 0 | 75 | 250 | 1024 | 64 | 1500 | 2500 | 50% | 5 |
| D ⭐ | 50 | 50 | 100 | 4000 | 4000 | 0 | 2800 | 4000 | 12% | 28 |
| E | 50 | 50 | 100 | 4000 | 4000 | 5000 | 2300 | 4000 | 15% | 20 |
| F (low limits) | 5 | 5 | 10 | 0 | 480 | 1000 | 700 | 1500 | 60% | 1 |
| G (generic preset) | 4 | 0 | 100 | 100 | 8000 | 0 | 1100 | 4000 | 80% | 2 |
| H | 50 | 50 | 100 | 4000 | 4000 | 2500 | 2500 | 4000 | 15% | 30 |
The numbers deliver a handful of very clear lessons:
1. The "recommended" generic settings were the worst (G). The "generic preset" configuration, lifted from online tuning guides, came in dead last with 80% errors. Its low 2 GB RAM usage is deceptive; the system spends few resources not because it carries the load, but because it rejects most of the requests. This is the single most important warning a load test gives: low resource usage is not always good news.
2. Limits set too small die early (F). The low-limit configuration with MaxRequestWorkers = 480 began to collapse at just 700 users. With a target of 4,000 users, a setting that can serve at most 480 requests at once is mathematically inadequate from the start.
3. The winner was D, but its edge lies in a subtlety. Configuration D was the only balanced profile that held to the end of the load (4,000), produced the latest first error (2,800 users), and kept the error rate at a reasonable 12%. The formula that won it:
StartServers = 50 + MinSpareServers = 50 → Workers wait pre-warmed; when the load wave hits, no time is lost spinning up processes from scratch.ServerLimit = 4000 + MaxRequestWorkers = 4000 → Capacity scaled exactly to the target load.MaxConnectionPerChild = 0 → Workers are not recycled after a fixed number of requests.4. Worker recycling was harmful under load (E and H). E (MaxConn/Child = 5000) and H (= 2500) had almost identical settings to D; the only difference was that workers were periodically killed and restarted. The result: the first error slipped from D's 2,800 down to 2,300-2,500. Recycling workers in the middle of heavy load fluctuates capacity exactly when it is needed most. A setting that is useful under light traffic can trip you up at peak load.
5. The current configuration (A) was actually not bad. The current setting, which can be taken as the baseline, delivered the lowest error rate (10%) but could not hold to the end of the load (it stopped at 3,800). D, at the cost of a small increase in error rate (10% -> 12%), kept the system alive all the way to 4,000, a reasonable trade for resilience.
While the web server layer was fighting, the database layer stayed surprisingly calm. Two separate tuning rounds were tried:
| Metric | DB Round 1 | DB Round 2 |
|---|---|---|
| First error (users) | 3800 | 3900 |
| Held until | 4000 | 4000 |
| RAM (GB) | 31 | 30 |
| Error rate | 1% | 1% |
| Critical listing query time | 0.6 s | 0.5 s |
In both rounds the database held to the end of the load with just 1% errors. That says a lot: the real bottleneck was not the database, but the web server layer. The second tuning round (cache and working-memory settings, parallel worker counts, and so on) pulled the most-called listing query from 0.6 seconds down to 0.5 seconds, a small but concrete improvement.
One of the most frequently executed queries contained a search with a leading wildcard (LIKE '%...%') on a text field. This pattern has a significant drawback: leading-wildcard searches cannot use any index and force a full table scan on every call. While 0.5 seconds looks acceptable today, this query will slow down linearly as the underlying table grows. Modeling this relationship through a separate table in the future (or at least considering full-text search / a suitable index structure) is the clearest opportunity to speed this query up for good.
The test in three sentences:
MaxRequestWorkers and ServerLimit should be set according to the expected concurrent-user count, neither too high (wasted resources and instability) nor too low (early collapse).MaxConnectionPerChild) can be harmful exactly when the most capacity is needed.With this configuration, the system will run noticeably more stably and sustainably under current traffic scenarios. The next step is to repeat the test after the recommended RAM upgrade and to measure the index optimization of the critical query.
Field notes - summer 2025.
Cover photo by Frantisek Duris on Unsplash.