Sizing a load test environment from last quarter's peak traffic
Teams that treat production on AWS as the only environment that behaves like production under load often skip the load test, or run it on a small QA stack whose numbers nobody trusts. A separate environment needs three inputs: the arrival rate in last quarter's busiest minute, the mix of requests in that minute, and the production settings that decide where a request waits. The first two come from load balancer metrics and access logs, and the third comes from production's configuration. Tests that span regions, or that depend on AWS services with no replacement elsewhere, stay with the provider that runs production.
CloudWatch keeps data by the minute for 15 days.
While requests are flowing, an Application Load Balancer sends RequestCount to CloudWatch every 60 seconds. CloudWatch keeps those points one minute apart for 15 days, five minutes apart until day 63, and one hour apart until day 455. Nine weeks after a peak, CloudWatch returns it only as hourly sums.
Take Fernhollow Timekeeping, a hypothetical vendor of time clock software for hourly staff. Every figure in this example is invented. Its busiest hour last quarter shows 1,728,000 requests, an average of 480 a second. The test has to reproduce the busiest minute inside that hour, and an hourly sum cannot show it.
Count the busiest minute from the access logs
Access logs record individual requests, if someone turned them on. They are off by default. Once they are on, the load balancer writes them to an S3 bucket, where a lifecycle rule may have deleted last quarter's files. Each entry carries two timestamps: time marks when the load balancer generated the response, and request_creation_time marks when the request arrived. Count by request_creation_time, because the test is written in arrivals. Fernhollow's busiest minute, at the start of a morning shift, holds 48,000 requests. That is 800 a second, two thirds above the hourly average. Where no access logs exist, count the same minute from the application's own request log.
Set each stage as an arrival rate
Stage one replays the busiest minute, 800 requests a second, and holds it until caches and connection pools settle. For the second stage, pick a rate the team can give a reason for. At Fernhollow, the largest account in the sales pipeline would add half again as many users, which makes it 1,200. The last stage climbs until the error rate or the response time crosses a limit the team set before the run. AWS's Reliability Pillar guidance on load testing (REL07-BP04) also says a test should find the breaking point, and it lists stopping at a small safety factor above expected load as another of those mistakes.
Write every stage as arrivals per second. A script built on a fixed count of virtual users starts each iteration only when the previous one finishes. When the application slows, that script slows with it, and the arrival rate tapers off in the stage that was meant to hold it steady. k6's documentation calls this the closed model. Its two arrival rate executors, constant-arrival-rate and ramping-arrival-rate, start iterations at the configured rate for as long as a virtual user is free to run one.
export const options = {
thresholds: {
http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }],
http_req_duration: [{ threshold: 'p(95)<200', abortOnFail: true }],
},
scenarios: {
clock_punches: {
executor: 'ramping-arrival-rate',
startRate: 50,
timeUnit: '1s',
preAllocatedVUs: 200,
stages: [
{ target: 440, duration: '10m' }, // ramp to the busiest minute
{ target: 440, duration: '30m' }, // stage one
{ target: 660, duration: '10m' },
{ target: 660, duration: '30m' }, // stage two
{ target: 1320, duration: '30m' }, // stage three, ends when a threshold fails
],
},
},
};If each iteration in this scenario sends one request, iterations per second equal requests per second. Timesheet views, search and the export get a scenario each, with the rates from the table. In the last stage each one ramps to three times its first stage rate, so the mix holds. For clock punches that is 1,320, the final target in the code block. The two thresholds are the sample limits from k6's documentation, standing in for the team's own, and abortOnFail stops the run when either one fails.
k6 needs a free virtual user to start an iteration. Its documentation estimates preAllocatedVUs as the median iteration time multiplied by the rate, plus an allowance for variance. With Fernhollow's 0.1 second median, 1,320 arrivals a second keep 132 virtual users busy, and the scenario allocates 200. If responses slow until all 200 are in use, k6 skips the iterations it cannot start and counts them in dropped_iterations. A count that rises late in a stage can point to an application that has slowed.
Production settings to copy at full size
The first stage replays a rate production already carried. If the test environment fails at that rate, something in it differs from production, and these rows show where to look.
| Component | In the test environment | Reason |
|---|---|---|
| Application and database servers | Production's vCPU and memory per node, production's storage throughput, and the node count that served the busiest minute | AWS's Reliability Pillar lists a test deployment configured differently from production among the same mistakes |
| Dataset | Row counts at production scale | PostgreSQL's planner can choose a different plan for a small table than for a large one |
| Pool sizes, connection limits, timeouts | Production's values | Requests queue here. HikariCP blocks getConnection() for up to connectionTimeout once maximumPoolSize connections are in use, so a smaller pool makes requests wait at a lower arrival rate than production's pool would |
| Payment, identity and email providers | Stubs that answer with the latency production's logs show | A third party's live system stays out of the run |
| Load generators | Machines separate from the application servers, with CPU at or below 80 percent | k6's guidance: a generator at 100 percent CPU can report response times much longer than the application produced |
Some differences will remain, such as a smaller node count or a stubbed provider. Keep a list of each one beside the results, so a reader can tell which numbers the differences could have moved. When a stage exposes a bottleneck, change one setting, rerun on the same environment, and record what changed.
What a passing test proves in dev, QA and staging covers the SQL Server edition, collation and sql_mode differences to check first.
When the logs undercount demand
The logged peak is the traffic production served. RequestCount goes up only when the load balancer could choose a target, so a request rejected before that point never appears in it. AWS describes access logging as best effort and recommends against treating the logs as a complete accounting of requests. Check RejectedConnectionCount and HTTPCode_ELB_5XX_Count for the peak hour. If either is above zero, production was failing requests during that hour, and 800 a second may undercount demand.
A quarter also misses whatever happens once a year, such as a renewal season or a filing deadline, and it holds no record of a launch that has yet to happen. Treat the logged peak as the floor for stage one. Stages two and three cover the difference.
Leave tests that span regions with the current provider
A test of failover between regions, or of response times for users on another continent, needs the regions production uses, so it belongs with the provider that runs production. So does a test of an application that calls managed AWS services it cannot replace elsewhere, because a run without them measures a different system. An application in one region, built on servers and a database, has no such tie, and its load test can run wherever the production configuration can be matched.
Start with last quarter's busiest minute and the request table.
Sources
The statements about AWS, k6, PostgreSQL and HikariCP come from these pages, last read on November 6, 2026.
- Amazon CloudWatch concepts, data retention: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html
- CloudWatch metrics for an Application Load Balancer,
RequestCount: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html - Access logs for an Application Load Balancer: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html
- AWS Well Architected Reliability Pillar,
REL07-BP04Load test your workload: https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/rel_adapt_to_changes_load_tested_adapt.html - k6 open and closed models: https://grafana.com/docs/k6/latest/using-k6/scenarios/concepts/open-vs-closed/
- k6 arrival rate VU allocation: https://grafana.com/docs/k6/latest/using-k6/scenarios/concepts/arrival-rate-vu-allocation/
- k6 dropped iterations: https://grafana.com/docs/k6/latest/using-k6/scenarios/concepts/dropped-iterations/
- k6
ramping-arrival-rateexecutor: https://grafana.com/docs/k6/latest/using-k6/scenarios/executors/ramping-arrival-rate/ - k6 thresholds: https://grafana.com/docs/k6/latest/using-k6/thresholds/
- k6 running large tests: https://grafana.com/docs/k6/latest/testing-guides/running-large-tests/
- PostgreSQL documentation, using EXPLAIN: https://www.postgresql.org/docs/current/using-explain.html
- HikariCP README, connection pool sizing: https://github.com/brettwooldridge/HikariCP