Load Testing Junior cheat sheet: interview answers

Every question of this level with its correct answer and explanation, on one page for a quick review before the interview.

  1. 1. What is the main goal of a load test?

    Correct answer: Check how the system behaves under the expected number of users

    A load test applies the traffic you expect in production, usually the normal peak, and checks that response times and error rates stay within targets.

  2. 2. How does a stress test differ from a load test?

    Correct answer: It pushes past the expected load to see where and how the system breaks

    A load test stays at the expected level. A stress test goes above it to find the breaking point and to see whether the system degrades gracefully and recovers.

  3. 3. What does a spike test check?

    Correct answer: How the system copes with a sudden, sharp jump in traffic

    A spike test jumps from low to very high load in seconds, like a flash sale or a push notification, and checks whether the system survives and recovers.

  4. 4. What is a soak (endurance) test for?

    Correct answer: Finding problems that appear only after hours of steady load

    A soak test keeps a normal load for hours. It reveals memory leaks, growing queues, filling disks and connections that are never released.

  5. 5. In k6 terms, what is a smoke test?

    Correct answer: A tiny run with minimal load to check that the script and system work

    A smoke test uses one or a few virtual users for a short time. It catches script errors and broken endpoints before you spend time on a real load test.

  6. 6. What does a breakpoint test do?

    Correct answer: Raises load gradually until the system fails, to find its capacity

    A breakpoint test ramps load up step by step, often to unrealistic levels, until errors or latency cross a limit. The point where that happens is the capacity.

  7. 7. What does throughput usually mean in load testing?

    Correct answer: The number of requests or transactions the system handles per second

    Throughput is work per unit of time, typically requests per second (RPS) or transactions per second (TPS). Latency is the time per request.

  8. 8. What is latency (response time) of a request?

    Correct answer: The time from sending the request to receiving the response

    Response time is measured per request from the client side. Load tests collect many of these and summarize them with percentiles.

  9. 9. What does "p95 response time = 400 ms" mean?

    Correct answer: 95% of requests took 400 ms or less

    The 95th percentile is the value below which 95% of measurements fall. The slowest 5% of requests took longer than 400 ms.

  10. 10. Why are percentiles preferred over the average response time?

    Correct answer: The average hides slow outliers that many real users still hit

    A few very slow requests barely move the mean, and a few very fast ones can pull it down. Percentiles such as p95 and p99 show what the slowest users experience.

  11. 11. Which percentile equals the median?

    Correct answer: p50

    Half of the values are below the median and half above, so it is the 50th percentile.

  12. 12. What is the error rate in a load test report?

    Correct answer: The share of requests that failed out of all requests sent

    Error rate = failed requests / total requests. It is a core metric alongside latency and throughput, and usually has its own threshold, e.g. under 1%.

  13. 13. What is a virtual user (VU) in a load testing tool?

    Correct answer: A simulated client that runs the test script in a loop

    A VU is an independent execution context that runs your script again and again. k6 runs each VU as its own JavaScript runtime.

  14. 14. What is think time in a load test script?

    Correct answer: A pause between actions that imitates a real user reading or typing

    Real users don't fire requests back to back. Pauses like sleep() make the request pattern and the load per user realistic.

  15. 15. Why do load tests usually start with a ramp-up instead of full load at once?

    Correct answer: To reach the target gradually and see at which load problems begin

    Ramping up lets caches and connection pools warm and shows how metrics change as load grows. Jumping straight to peak is a spike test, which is a different question.

  16. 16. In a k6 script, what does the exported default function contain?

    import http from 'k6/http';
    
    export default function () {
      http.get('https://test.k6.io');
    }

    Correct answer: The code each virtual user runs on every iteration

    The default function is the VU code. Each VU runs it in a loop for the duration of the test. One-time preparation goes into setup().

  17. 17. What load does this k6 configuration create?

    export const options = {
      vus: 10,
      duration: '30s',
    };

    Correct answer: 10 virtual users running the script in a loop for 30 seconds

    vus sets the number of concurrent virtual users and duration how long they keep iterating. The total number of requests depends on how fast each iteration runs.

  18. 18. What does this stages setting describe?

    export const options = {
      stages: [
        { duration: '2m', target: 100 },
        { duration: '5m', target: 100 },
        { duration: '1m', target: 0 },
      ],
    };

    Correct answer: Ramp up to 100 VUs, hold for 5 minutes, then ramp down

    Each stage moves the VU count linearly to target over duration. This is the classic ramp-up, steady state and ramp-down shape.

  19. 19. What does check() do in k6?

    check(res, {
      'status is 200': (r) => r.status === 200,
    });

    Correct answer: Records whether a condition passed, without stopping the test

    Checks are like assertions that don't abort anything. k6 counts passes and failures and shows the pass rate in the summary.

  20. 20. What is a threshold in k6?

    export const options = {
      thresholds: {
        http_req_duration: ['p(95)<500'],
      },
    };

    Correct answer: A pass/fail criterion on a metric: the run fails if it is not met

    Thresholds turn metrics into a verdict. If p95 is 500 ms or more here, k6 marks the threshold as failed and exits with a non-zero code, which fails a CI job.

  21. 21. A k6 run has 30% failed checks but no thresholds. What exit code does k6 return?

    Correct answer: Zero: failed checks alone don't fail the run

    Checks only record results. To fail the run on checks, add a threshold on the checks metric, e.g. checks: ['rate>0.99'].

  22. 22. Which built-in k6 metric holds the total time of an HTTP request?

    Correct answer: http_req_duration

    http_req_duration is sending + waiting + receiving. http_req_connecting is only the TCP connection, and iteration_duration covers the whole loop of the default function.

  23. 23. What does the k6 metric http_req_failed measure by default?

    Correct answer: The rate of requests with an error status (4xx/5xx) or network error

    By default, statuses 200-399 count as success. You can change the expected statuses with http.setResponseCallback().

  24. 24. What does the iterations metric in a k6 summary count?

    Correct answer: How many times VUs completed the default function

    One iteration is one full pass through the default function. One iteration can send several requests.

  25. 25. How do you run a k6 script from the command line?

    Correct answer: k6 run script.js

    k6 run executes the script locally. Options such as --vus and --duration can override the values in the script.

  26. 26. In JMeter, what does a Thread Group define?

    Correct answer: How many threads (users) run, how fast they start and how long

    A Thread Group is the user model: number of threads, ramp-up period and loop count or duration. Samplers inside it are what each thread does.

  27. 27. What is a sampler in JMeter?

    Correct answer: An element that sends a request, such as an HTTP Request

    Samplers do the actual work: HTTP, JDBC, JMS and so on. Timers add pauses, and listeners collect results.

  28. 28. Why should real JMeter load tests run in CLI (non-GUI) mode?

    Correct answer: The GUI and its listeners use a lot of resources and distort results

    The JMeter docs say the GUI is for building and debugging a plan. Heavy listeners like View Results Tree consume memory and CPU on the load generator.

  29. 29. What does this JMeter command do?

    jmeter -n -t plan.jmx -l results.jtl

    Correct answer: Runs plan.jmx without the GUI and writes results to results.jtl

    -n is non-GUI mode, -t the test plan and -l the results log. Adding -e -o dir also generates an HTML report.

  30. 30. In which language do you write Locust tests?

    Correct answer: Python

    Locust user behaviour is plain Python classes and methods. k6 uses JavaScript, and Gatling uses Java, Kotlin, Scala or JavaScript.

  31. 31. Why should a load test environment be close to production?

    Correct answer: Results on smaller hardware or other settings don't predict prod

    Different instance sizes, data volumes, caches or network setup change where the bottleneck is. Scaling results from a small env is unreliable.

  32. 32. What is a performance baseline?

    Correct answer: Reference results from a known version to compare future runs against

    With a baseline you can say whether a new build is slower. Without one, a single result like "p95 = 300 ms" has nothing to compare to.

  33. 33. Why is "100 concurrent users" not the same as "100 requests per second"?

    Correct answer: Each user waits for responses and pauses, so RPS depends on timing

    RPS = users / (response time + think time). 100 users with 2 s per loop give about 50 RPS. Slower responses mean even fewer RPS.

  34. 34. What is a bottleneck in performance testing?

    Correct answer: The resource that limits throughput for the whole system

    It can be CPU, a DB connection pool, a lock, a slow external API or the network. Adding capacity anywhere else doesn't help until you remove it.

  35. 35. Why monitor server CPU, memory and DB during a load test?

    Correct answer: Client metrics show that it's slow, server metrics show why

    Latency and errors from the load tool tell you there is a problem. Utilization, saturation and errors on servers point to the bottleneck.

  36. 36. The load generator's CPU is at 100% during a test. What does that mean for the results?

    Correct answer: They may be invalid: the generator itself is the bottleneck

    An overloaded generator sends fewer requests and measures time late, so latency looks worse or RPS lower than reality. Add generators or reduce load per machine.

  37. 37. Why should a load test not reuse a single user and product ID for every request?

    Correct answer: Caches will serve it, so results look faster than real traffic

    Real users hit many different records. One hot ID stays in cache and avoids DB work, so results are too optimistic. Use parameterized test data.

  38. 38. What is parameterization in a load test script?

    Correct answer: Feeding different input data, e.g. from CSV, to each iteration

    Parameterization replaces hard-coded values with data from files or generators, so each VU uses its own logins, IDs or search terms.

  39. 39. What is correlation in a load test script?

    Correct answer: Capturing dynamic values from a response and reusing them later

    Session IDs, CSRF tokens or order IDs change on every run. The script must extract them from responses, e.g. with JSON parsing or regex, and send them in the next request.

  40. 40. Why exclude the first minute or two of a test from the analysis?

    Correct answer: Caches, JIT and connection pools are still warming up

    Cold caches and JIT compilation make the start slower than steady state. A warm-up period keeps those numbers from skewing results, unless cold start is what you test.

  41. 41. What is an SLO in the context of performance?

    Correct answer: A target for a service level, e.g. 99% of requests under 300 ms

    A Service Level Objective is an internal target for an SLI such as latency or availability. An SLA is the external agreement, often with penalties.

  42. 42. A service handles 50 requests per second, and each takes 0.2 s on average. How many requests are in progress at once on average?

    Correct answer: 10

    Little's law: L = λ × W = 50 × 0.2 = 10. It links throughput, time in the system and concurrency.

  43. 43. What does scalability mean for a system?

    Correct answer: Its ability to handle more load by adding resources

    A scalable system gains throughput roughly in line with added servers or CPUs. Scalability tests check how close to linear that is.

  44. 44. What is horizontal scaling?

    Correct answer: Adding more instances of a service behind a load balancer

    Horizontal scaling adds machines. Vertical scaling makes one machine bigger. Horizontal scaling needs stateless services or shared state.

  45. 45. Under load, the API starts returning 429. What does it mean?

    Correct answer: Rate limiting: the client sent too many requests

    429 Too Many Requests means a rate limiter rejected the call. In a load test it may mean the test hits a limit rather than a real capacity problem.

  46. 46. What does a 503 response during a load test usually indicate?

    Correct answer: The service or a proxy is overloaded or temporarily unavailable

    503 Service Unavailable often comes from a load balancer with no healthy backends or from a server shedding load. It's a common sign of saturation.

  47. 47. How are timeouts usually counted in load test results?

    Correct answer: As failed requests, and they add to the error rate

    A request that didn't finish within the timeout is a failure for the user. k6's default HTTP timeout is 60 s, which is often too long for a realistic check.

  48. 48. How does performance testing relate to load testing?

    Correct answer: Performance testing is the umbrella, load testing is one type of it

    Performance testing covers load, stress, spike, soak, scalability and volume tests. Each answers a different question about speed and stability.

  49. 49. Why must a load test against a shared or production environment be agreed in advance?

    Correct answer: It can slow down or break the service for others and trigger alerts

    Unannounced load looks like an attack: it fires alerts, may trigger WAF or DDoS protection and hurts real users. Agree on time, limits and a stop plan.

  50. 50. Where should the target load for a load test come from?

    Correct answer: Production analytics: peak traffic, user mix and growth plans

    A realistic target is based on observed peaks, the mix of actions and expected growth or events. Guessing gives tests that answer the wrong question.

  51. 51. Is a Lighthouse audit a load test?

    Correct answer: No: it measures one page load in one browser, not the system under load

    Lighthouse checks frontend performance for a single visit. Load tests check how servers behave when many users act at the same time.

  52. 52. Which k6 metric is closest to time to first byte (TTFB)?

    Correct answer: http_req_waiting

    http_req_waiting is the time from sending the request until the first byte of the response. It mostly reflects server processing time.

  53. 53. Why add sleep(1) at the end of a k6 iteration?

    export default function () {
      http.get('https://test.k6.io');
      sleep(1);
    }

    Correct answer: To add think time so each VU doesn't fire requests nonstop

    Without pauses, each VU hammers the server as fast as responses come back. That's fine for some tests but doesn't model real users.

  54. 54. What does group() do in k6?

    Correct answer: Groups requests under a name so the summary shows them together

    Groups organize a script into steps like "login" or "checkout". k6 reports a group_duration metric per group.

  55. 55. Why add tags to k6 requests?

    Correct answer: To filter metrics and set thresholds per request type

    Tags such as name or custom ones let you see p95 for /search separately from /login, and define thresholds like http_req_duration{name:search}.

  56. 56. When does setup() run in k6?

    Correct answer: Once, before the virtual users start

    setup() runs once and its return value is passed to the default function, e.g. an auth token. teardown() runs once at the end.

  57. 57. How do you read an environment variable in a k6 script?

    Correct answer: __ENV.BASE_URL

    k6 doesn't run on Node.js, so there is no process. Variables come from the system or -e BASE_URL=... and are read via __ENV.

  58. 58. How can you send k6 results to a file or a monitoring system?

    Correct answer: With the --out option, e.g. JSON, CSV or Prometheus

    k6 run --out json=results.json streams every data point. Other outputs include CSV, InfluxDB and Prometheus remote write.

  59. 59. The max response time is 9 s, but p99 is 350 ms. How do you read it?

    Correct answer: A few rare outliers; most users don't see them, but find their cause

    Max is a single worst value. It can come from one GC pause or retry. Check how often it happens and whether it correlates with something.

  60. 60. What is the steady state of a load test?

    Correct answer: The period at target load after the ramp-up, when metrics settle

    Measurements from the steady state are the ones you compare to targets. Ramps and warm-up add noise.

  61. 61. Load grows, throughput stops growing, and latency rises sharply. What is happening?

    Correct answer: The system reached saturation: requests now queue up

    After the knee point, extra requests can't be served faster, so they wait in queues. Latency grows while throughput stays flat or even drops.

  62. 62. Why can results from two runs differ even with the same script?

    Correct answer: Caches, other traffic, GC and infrastructure add natural variance

    Performance is noisy. Run tests more than once, use the same data and environment, and compare trends instead of single numbers.

  63. 63. Under load, DB queries are fast but the app waits for a connection. What is the likely bottleneck?

    Correct answer: The database connection pool is too small

    If queries are quick but requests wait to get a connection, the pool is saturated. Check pool size, connection hold time and leaks.

  64. 64. What is a workload model?

    Correct answer: The mix and rate of user actions the test reproduces

    For example: 60% browse, 30% search, 10% checkout at a given arrival rate. Testing one endpoint at a time misses how actions compete for resources.

  65. 65. What is tail latency?

    Correct answer: The response time of the slowest requests, like p99 or p99.9

    Tail latency affects many users in large systems, because one page may call many services. One slow call makes the whole page slow.

  66. 66. The server returns 200 with an error page under load. How do you catch it?

    Correct answer: Check the response body, not only the status code

    Some apps return "Something went wrong" with 200. A check on the body or a key field catches it; status-only checks don't.

  67. 67. What kind of load test fits into a CI pipeline on every pull request?

    Correct answer: A short smoke-sized test with thresholds

    Short runs catch obvious regressions quickly. Heavy load, soak and stress tests run on a schedule or before releases.

  68. 68. What does a Response Assertion in JMeter do?

    Correct answer: Marks a sample as failed if the response doesn't match a rule

    Assertions can check text, status code, size, JSON paths or duration. Failed assertions show up as errors in reports.

  69. 69. What is a Timer used for in JMeter?

    Correct answer: Adding a delay before samplers, to model think time

    Without timers, JMeter threads send requests back to back. Constant, Uniform Random and Gaussian timers add realistic pauses.

  70. 70. What does volume testing focus on?

    Correct answer: How the system behaves with large amounts of data

    Volume tests fill tables, queues or files with large data sets to see how queries, backups and reports perform as data grows.

  71. 71. The CPU of an API server is at 30% while latency is high. Which is a likely cause?

    Correct answer: Waiting on something else: a DB, a lock, an external API

    Low CPU and high latency mean requests wait rather than compute. Look at downstream calls, locks, thread pools and connection pools.

  72. 72. Why include the network location of load generators in the test plan?

    Correct answer: Distance and bandwidth add latency and can cap throughput

    Generators far from the system add round-trip time. A narrow uplink limits how much traffic they can send. Results must state where load came from.

  73. 73. What does teardown() in k6 do?

    Correct answer: Runs once after all VUs finish, e.g. to clean up test data

    teardown() receives the data from setup(). It is the place to delete users or orders the test created.

  74. 74. Which three metrics does the RED method look at for each service?

    Correct answer: Rate, Errors and Duration

    RED is for request-driven services: how many requests, how many fail, and how long they take. It matches what load tests measure.

  75. 75. Why is a single run at full load not enough to call a system ready?

    Correct answer: One run says little about variance, trends or other load shapes

    Repeat runs, a soak and a spike give a fuller picture. One lucky run can hide regressions or rare failures.