#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Non-Functional Testing

Stress Testing

What is Stress Testing?

Stress testing pushes the application beyond its normal operational capacity to identify its breaking point and how gracefully it fails or recovers.

Key Aspects Verified

  • The application's behaviour when resources are exhausted (CPU, memory, bandwidth).
  • Whether the system fails gracefully or crashes catastrophically under extreme load.
  • How well the system recovers once the stress condition is removed.

Load vs Stress Testing

Load testing verifies performance under expected conditions, while stress testing deliberately exceeds those conditions to find the system's limits.

Running a Stress Test, Step by Step

  1. Know the normal load. Find out the expected number of users or requests from analytics or requirements. You cannot go "beyond normal" without knowing what normal is.
  2. Pick the critical journeys. Login, search and checkout usually matter more than rarely used pages.
  3. Prepare an isolated environment. Use a production-like setup, not production itself, unless the business has formally approved a controlled test window.
  4. Ramp up in stages. Increase load gradually past the expected peak until errors or response times become unacceptable.
  5. Hold, then remove the load. Watch how the system behaves at the edge and how quickly it returns to normal afterwards.
  6. Analyse and report. Record the breaking point, the first component to fail, and the recovery time.

A Sample Script with k6

k6 is an open-source load testing tool where scenarios are written in JavaScript. The stages below climb well past an assumed normal load, then drop to zero to observe recovery.

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  stages: [
    { duration: '2m', target: 100 },   // normal load
    { duration: '3m', target: 300 },   // above normal
    { duration: '3m', target: 600 },   // well beyond expected peak
    { duration: '2m', target: 0 },     // remove load, watch recovery
  ],
};

export default function () {
  const res = http.get('https://staging.example.com/products');
  check(res, { 'status is 200': (r) => r.status === 200 });
  sleep(1);
}

Run it with k6 run stress.js. Apache JMeter, Gatling and Locust can model the same pattern if your team already uses them.

What to Measure and How to Read It

  • Error rate: the load level where errors start climbing is often the practical breaking point.
  • Response time percentiles: the 95th or 99th percentile shows what slow users experience, which averages hide.
  • Server resources: CPU, memory, disk I/O, open connections and thread pools on every tier.
  • Database behaviour: lock waits, slow queries and connection pool exhaustion.
  • Recovery: time taken for response times and error rates to return to normal once load drops.

A good outcome is not "the system never fails". It is a system that slows down or rejects extra requests politely, shows clear error messages, keeps data consistent and recovers without manual restarts.

Stress Testing Compared with Related Tests

Test typeLoad patternQuestion it answers
LoadExpected peakDoes it meet targets under normal busy conditions?
StressBeyond peak until failureWhere does it break, and how does it recover?
SpikeSudden jumpCan it survive a sudden rush, such as a sale launch?
SoakSteady load for hoursDo memory leaks or slow degradation appear over time?

Common mistakes include testing from one weak load generator that becomes the bottleneck itself, ignoring caches that make results look better than reality, and forgetting to warn infrastructure or security teams before generating heavy traffic.

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course