Bird
Raised Fist0
Testing Fundamentalstesting~6 mins

Performance metrics (response time, throughput) in Testing Fundamentals - Full Explanation

Choose your learning style10 modes available
Introduction
Imagine using a website that takes forever to load or a service that can only handle a few users at a time. These problems happen because of performance issues. To understand and fix these, we use performance metrics that measure how fast and how much a system can handle.
Explanation
Response Time
Response time measures how long it takes for a system to react to a request. It starts when a user sends a request and ends when the system finishes processing and sends back a result. This metric helps us know how quickly users get feedback from the system.
Response time shows how fast a system responds to a single request.
Throughput
Throughput measures how many requests a system can handle in a given time, usually per second or minute. It tells us about the system's capacity to process multiple requests efficiently. Higher throughput means the system can serve more users or tasks at once.
Throughput indicates the volume of work a system can process over time.
Real World Analogy

Think of a coffee shop where customers place orders. Response time is like how long a customer waits from ordering to receiving their coffee. Throughput is how many customers the shop can serve in an hour.

Response Time → Time a customer waits for their coffee after ordering
Throughput → Number of customers served by the coffee shop in one hour
Diagram
Diagram
┌───────────────┐       ┌───────────────┐
│ User Request  │──────▶│ System        │
│ (Start Timer) │       │ Processes Req │
└───────────────┘       └───────────────┘
         │                       │
         │                       │
         │                       ▼
         │               ┌───────────────┐
         │               │ Response Sent │
         │               │ (Stop Timer)  │
         │               └───────────────┘
         ▼
  Response Time

Throughput: Number of requests processed per unit time (e.g., per second)
This diagram shows the flow of a user request through the system to measure response time and how throughput counts requests over time.
Key Facts
Response Time → The duration between sending a request and receiving a response from the system.
Throughput → The number of requests a system can process in a given time period.
Low Response Time → Means the system responds quickly to individual requests.
High Throughput → Means the system can handle many requests efficiently.
Code Example
Testing Fundamentals
import time

# Simulate processing a request
start_time = time.perf_counter()
time.sleep(0.2)  # Simulate work taking 0.2 seconds
end_time = time.perf_counter()

response_time = end_time - start_time
print(f"Response time: {response_time:.3f} seconds")

# Simulate throughput calculation
requests_processed = 50
total_time_seconds = 10
throughput = requests_processed / total_time_seconds
print(f"Throughput: {throughput} requests per second")
OutputSuccess
Common Confusions
Response time and throughput are the same.
Response time and throughput are the same. Response time measures speed for one request, while throughput measures how many requests are handled over time.
A system with high throughput always has low response time.
A system with high throughput always has low response time. A system can handle many requests (high throughput) but still respond slowly to each one (high response time) if overloaded.
Summary
Response time measures how quickly a system answers a single request.
Throughput measures how many requests a system can handle in a set time.
Both metrics help understand and improve system performance but focus on different aspects.

Practice

(1/5)
1. What does response time measure in performance testing?
easy
A. The total number of requests per second
B. How fast a single request is completed
C. The amount of data transferred in a request
D. The number of users accessing the system

Solution

  1. Step 1: Understand response time meaning

    Response time measures the duration taken to complete one request from start to finish.
  2. Step 2: Differentiate from throughput

    Throughput measures how many requests happen over time, not the speed of one request.
  3. Final Answer:

    How fast a single request is completed -> Option B
  4. Quick Check:

    Response time = speed of one request [OK]
Hint: Response time = speed of one request [OK]
Common Mistakes:
  • Confusing response time with throughput
  • Thinking response time counts total requests
  • Mixing data size with response time
2. Which of the following is the correct unit commonly used to measure throughput?
easy
A. Milliseconds (ms)
B. Bytes
C. Requests per second (RPS)
D. Percentage (%)

Solution

  1. Step 1: Identify throughput unit

    Throughput measures how many requests are processed per unit time, commonly requests per second (RPS).
  2. Step 2: Exclude other units

    Milliseconds measure time, bytes measure data size, and percentage is not a throughput unit.
  3. Final Answer:

    Requests per second (RPS) -> Option C
  4. Quick Check:

    Throughput = requests per second [OK]
Hint: Throughput counts requests per second [OK]
Common Mistakes:
  • Using time units for throughput
  • Confusing data size with throughput
  • Selecting percentage as throughput unit
3. Given a system that processes 120 requests in 10 seconds, what is the throughput?
medium
A. 10 requests per second
B. 0.12 requests per second
C. 1200 requests per second
D. 12 requests per second

Solution

  1. Step 1: Calculate throughput formula

    Throughput = Total requests / Total time = 120 / 10 seconds.
  2. Step 2: Perform division

    120 divided by 10 equals 12 requests per second.
  3. Final Answer:

    12 requests per second -> Option D
  4. Quick Check:

    120 ÷ 10 = 12 [OK]
Hint: Divide total requests by total time [OK]
Common Mistakes:
  • Dividing time by requests instead of requests by time
  • Multiplying requests and time
  • Confusing throughput with response time
4. A tester recorded the following response times (in ms): 100, 200, 150, 250. The average response time was incorrectly calculated as 700 ms. What is the correct average response time?
medium
A. 175 ms
B. 700 ms
C. 150 ms
D. 200 ms

Solution

  1. Step 1: Sum all response times

    Add 100 + 200 + 150 + 250 = 700 ms total.
  2. Step 2: Calculate average response time

    Divide total 700 ms by 4 requests = 175 ms average.
  3. Final Answer:

    175 ms -> Option A
  4. Quick Check:

    700 ÷ 4 = 175 [OK]
Hint: Sum times, then divide by count [OK]
Common Mistakes:
  • Using total sum as average
  • Dividing by wrong number of requests
  • Mixing units in calculation
5. A web server has a throughput of 50 requests per second and an average response time of 200 ms. If the server's throughput doubles but response time remains the same, what happens to the server's capacity and user experience?
hard
A. Capacity doubles; user experience stays consistent
B. Capacity stays same; user experience worsens
C. Capacity doubles; user experience worsens
D. Capacity halves; user experience improves

Solution

  1. Step 1: Understand throughput doubling

    Doubling throughput means the server can handle twice as many requests per second, so capacity doubles.
  2. Step 2: Analyze response time unchanged

    Since response time stays at 200 ms, the speed per request remains consistent, so user experience does not worsen.
  3. Final Answer:

    Capacity doubles; user experience stays consistent -> Option A
  4. Quick Check:

    Throughput ↑, response time same = better capacity, same experience [OK]
Hint: More throughput + same response time = better capacity, same experience [OK]
Common Mistakes:
  • Assuming response time worsens with throughput increase
  • Confusing capacity with response time
  • Thinking capacity decreases when throughput increases
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard