Software Development Trending

What Is Load Testing? How to Test Your App Under Traffic

What load testing is, how load, stress, spike and soak tests differ, and how to read results like percentiles and error rates before real traffic finds your limits.

Quick answer

Load testing means simulating many users or requests at once to see how your app performs under expected traffic. You script realistic user journeys, run them at normal and peak volumes in a production-like environment, and watch response times, error rates and server resources. Stress, spike and soak tests push further to find limits and slow leaks.

What Is Load Testing? How to Test Your App Under Traffic

Photo: Unsplash

On this page

Your app works perfectly with 10 people using it. Then a marketing email goes out, a post goes viral or Black Friday arrives, and suddenly pages time out, checkouts fail and the database falls over. Nobody tested what happens when 2,000 people show up at once.

Load testing answers that question before your customers do. It simulates realistic traffic against your app so you can see how fast it responds, where it breaks and what to fix. This guide explains the main types of performance tests, how to run your first load test and how to read the results without a performance engineering background.

What load testing is

Load testing is a type of performance testing where you generate traffic against a system, usually many virtual users or requests per second, and measure how it behaves. The goal is to confirm that the app meets its performance targets at the traffic levels you expect.

A load test tells you:

  • How quickly pages and API calls respond under normal and peak traffic
  • How many requests fail as traffic rises
  • Which part of the system becomes the bottleneck first: database, application servers, a third-party API or the network
  • Whether autoscaling actually kicks in when it should
  • How much infrastructure you need, which feeds directly into your cloud bill

Functional tests ask “does it work?” Load tests ask “does it still work when lots of people use it at the same time?”

Load, stress, spike and soak tests compared

“Load testing” is often used as an umbrella term. Grafana’s k6 documentation breaks performance tests into 6 common types:

Test type What it does Typical duration Question it answers
Smoke test Minimal load to check the script and system work Seconds to a few minutes Is the test set up correctly?
Average-load test Simulates normal expected traffic About 5 to 60 minutes Do we meet targets on a typical day?
Stress test Pushes load above normal levels About 5 to 60 minutes How do we behave at peak, and do we recover?
Spike test A sudden, short, very large surge A few minutes Can we survive a flash sale or viral moment?
Soak test Normal load held for a long time Hours Do memory leaks, full disks or slow degradation appear over time?
Breakpoint test Gradually increases load until the system fails As long as needed Where is our maximum capacity?

k6’s guidance is to start with a smoke test, move to average-load tests and only then try more complex patterns. It also recommends simple shapes, such as ramp up, hold steady and ramp down, so results are easy to compare.

Which test should you run?

  • Before a launch or big campaign: average-load test at expected traffic, then a stress test at 1.5 to 2 times that level for headroom.
  • For flash sales, ticket drops or TV ads: spike test.
  • For systems that run for days without restarts: soak test to catch memory leaks and connection pool exhaustion.
  • For capacity planning: breakpoint test, run occasionally, to find your ceiling.

Most small teams get the biggest return from 2 tests: an average-load test and a stress test on their most important journeys.

How to run your first load test

1. Set clear targets. Write down what “good” means, for example: “95% of checkout requests respond in under 500 milliseconds at 200 requests per second, with an error rate under 1%.” Use your own business needs. Targets turn a load test from an experiment into a pass or fail check.

2. Pick realistic journeys. Use analytics to choose the flows that matter most and get the most traffic: home page, search, product page, login, add to cart, checkout, key API endpoints. Mix them in realistic proportions. Include think time between steps, because real users pause.

3. Use a production-like environment. AWS’s Well-Architected guidance recommends load testing in an environment that mirrors production as closely as possible, since a scaled-down copy can give misleading results. Use realistic data volumes, too. A database with 100 rows behaves very differently from one with 10 million.

4. Choose a tool. Common open source options include k6, Apache JMeter, Gatling and Locust. Cloud providers also offer managed load testing services. Note that protocol-level tools such as JMeter don’t run a real browser. Apache’s documentation states that JMeter does not execute the JavaScript in HTML pages, so it measures server and API performance rather than full page rendering.

5. Generate load from the right place. Run load generators outside the system under test, with enough capacity that they don’t become the bottleneck themselves.

6. Get permission and warn people. Tell your hosting provider and any third-party services you call, and follow their testing policies. AWS, for example, publishes a testing policy for simulated events, because heavy unannounced traffic can look like a denial-of-service attack. Never load test systems you don’t own or have permission to test.

7. Monitor everything during the test. Watch app servers, databases, caches and queues, not just the load tool’s numbers. Tracing tools built on OpenTelemetry help you see which service or query is slow.

How to read load test results

The numbers can look overwhelming. Focus on these.

Response time percentiles, not averages. Averages hide pain. Google’s Site Reliability Engineering book gives the example of a service with a 100 millisecond average where 1% of requests take 5 seconds. Look at:

  • p50 (median): half of requests are faster than this
  • p95: 95% are faster; this is a common target
  • p99: the slow tail that your unluckiest users feel

Throughput. Requests or transactions per second the system handled. If you increase virtual users but throughput stops rising, you’ve hit a bottleneck.

Error rate. Failed requests, timeouts and wrong responses. Rising errors usually mean resources are exhausted somewhere.

Saturation. How “full” your most limited resource is: CPU, memory, database connections, disk or thread pools. The SRE book lists latency, traffic, errors and saturation as the 4 golden signals to watch on user-facing systems.

The shape over time.

Pattern you see What it often means
Response times rise steadily as load rises, then shoot up You’ve reached capacity, so find the saturated resource
Errors appear at a specific user count A hard limit such as a connection pool, rate limit or file handle cap
Performance slowly degrades during a long test Memory leak, growing queue or log and disk build-up
Good average but terrible p99 Some requests hit slow paths: cache misses, locks or heavy queries
Load generator CPU at 100% Your test tool is the bottleneck, not your app
Recovery is slow after a spike Autoscaling is too slow or queues take long to drain

Key takeaway: A load test is only useful if you know what “good” looks like before you start. Set percentile, throughput and error-rate targets first, then test against them and fix the biggest bottleneck before testing again.

Common bottlenecks and fixes

  • Database queries: missing indexes, queries that return too much data or run in loops. Fixing these often gives the largest gains.
  • No caching: repeated work for content that rarely changes.
  • Connection limits: database or HTTP connection pools set too low, or too high for the database to handle.
  • Third-party APIs: payment, email or AI services with their own rate limits. Check their limits and SLAs. Our guide to reading a cloud SLA helps.
  • Autoscaling settings: scaling triggers that react too slowly for spikes.
  • Architecture limits: some issues need deeper design changes, which our microservices vs monolith guide touches on.

Fix 1 bottleneck at a time and re-run the same test. Otherwise you won’t know what helped. Remember that more servers cost money, so weigh fixes against your cloud bill using FinOps practices.

Where to start: make load testing routine

  1. Pick 3 critical journeys and script them in a load testing tool.
  2. Run a smoke test, then an average-load test against a staging environment that mirrors production.
  3. Set pass and fail thresholds for p95 response time and error rate.
  4. Add a short load test to your pipeline for key endpoints, so performance regressions are caught like functional ones. See how to build a CI/CD pipeline and regression testing.
  5. Run stress and spike tests before big events such as launches, sales and campaigns.
  6. Schedule a soak test a few times a year, or after major infrastructure changes.

Add load testing to your pre-launch software QA checklist so it never gets skipped.

Conclusion

Load testing shows how your app behaves when real crowds arrive. Start with clear targets, script realistic journeys and test in a production-like environment. Use average-load and stress tests for most releases, spike tests for big events and soak tests for slow problems that appear over time. Read percentiles, throughput, errors and saturation together, fix the biggest bottleneck first and test again. A few hours of testing beats a launch day outage.

Sources

Questions readers ask

Frequently asked questions

What is the difference between load testing and stress testing?

Load testing checks how your app performs at expected traffic levels, such as a normal busy day. Stress testing pushes traffic beyond those levels to find where performance breaks down and whether the system recovers afterwards. Most teams run a load test first to confirm normal performance, then a stress test to understand their safety margin.

How many users should I simulate in a load test?

Base it on real data. Use analytics to find your peak concurrent users or requests per second, then test at that level for an average-load test. For a stress test, go above it, often 1.5 to 2 times your expected peak or higher for big events. If you have no data yet, estimate from marketing plans and test a range.

What are the best load testing tools?

Widely used open source tools include k6, Apache JMeter, Gatling and Locust. Cloud providers also offer managed load testing services that generate traffic from their infrastructure. Choose based on your team's language skills, whether you need to test APIs or full browser behavior, and how easily the tool fits into your CI/CD pipeline.

Can I load test in production?

Sometimes, but carefully. Most teams load test in a staging environment that mirrors production, to avoid hurting real users. Some run controlled tests in production during quiet hours, with monitoring and a quick way to stop. Always warn your hosting provider and third-party services, follow their testing policies, and never test systems you don't own.

What is a good response time in a load test?

There's no universal number; it depends on your app and users. Many teams set targets on the 95th percentile, such as most API calls responding in a few hundred milliseconds, and keep error rates very low. Set targets from user expectations and business needs, then test against them consistently so you can spot regressions.

What is a soak test?

A soak test runs normal load for a long period, usually hours, to find problems that only appear over time. Examples include memory leaks, database connections that are never released, logs filling up disks and slowly growing queues. Run soak tests before launches and after major infrastructure changes, especially for systems that run continuously.

How much does load testing cost?

Costs vary widely. Open source tools like k6, JMeter and Locust are free to use, but you pay for the infrastructure that generates load and for the test environment itself. Managed cloud load testing services usually charge based on usage, such as virtual users or test duration. Check each provider's current pricing page, since rates change.

Reader reviews

Was this guide useful

No reviews yet. Share your experience and help other readers.

Write a review
Your rating
Never shown publicly

Reviews are checked before they appear. We never show your email. Please review only places or services you have used.

Manishdai
Written by

Manishdai

Manishdai writes about the technology that is reshaping every industry — from AI agents and cloud platforms to healthtech, fintech and the IT companies building it all across the United States.