Load Testing Middle 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 key difference between a closed and an open workload model?

    Correct answer: Closed: new requests wait for old ones. Open: arrivals don't depend on responses

    In a closed model a fixed number of users each send the next request after the previous one returns. In an open model requests arrive at a set rate, like real internet traffic, whatever the response time.

  2. 2. Why can a closed model hide a slowdown?

    Correct answer: When the server slows, users send fewer requests, so load drops by itself

    With 100 VUs and a 1 s response you get ~100 RPS. If responses take 5 s, you get ~20 RPS. The system gets relief that real traffic would never give it.

  3. 3. Which k6 executor keeps a fixed request rate regardless of response times?

    Correct answer: constant-arrival-rate

    Arrival-rate executors start iterations at the set rate and add VUs from the pool as needed. constant-vus is a closed model.

  4. 4. What load does this scenario generate?

    scenarios: {
      api: {
        executor: 'constant-arrival-rate',
        rate: 200,
        timeUnit: '1s',
        duration: '10m',
        preAllocatedVUs: 50,
        maxVUs: 300,
      },
    }

    Correct answer: 200 iterations per second for 10 minutes, using up to 300 VUs

    rate / timeUnit sets iterations started per second. k6 starts with 50 VUs and can add up to 300 if iterations take longer and more VUs are needed to keep the rate.

  5. 5. What does a non-zero dropped_iterations metric tell you in an arrival-rate test?

    Correct answer: k6 had no free VU to start an iteration, so the target rate wasn't reached

    If all VUs are busy and maxVUs is reached, k6 skips iterations. Raise maxVUs or note that the system was too slow to keep the rate.

  6. 6. You need 100 RPS, and one iteration takes about 1.5 s. Roughly how many VUs must be available?

    Correct answer: About 150

    By Little's law, concurrency = rate × time = 100 × 1.5 = 150. Add headroom, because iterations get slower under load.

  7. 7. What is coordinated omission?

    Correct answer: A tool waits for slow responses, so it skips requests and underreports latency

    If a closed-loop tool is blocked by a 2 s stall, the requests it would have sent during that stall are never measured. Percentiles look much better than users experienced.

  8. 8. What is the difference between shared-iterations and per-vu-iterations?

    Correct answer: Shared: a total split among VUs. Per-VU: each VU runs the given count

    With 10 VUs and iterations: 100, shared gives 100 in total (fast VUs do more). Per-VU gives each VU 100, so 1000 in total.

  9. 9. What does startTime do in a k6 scenario?

    Correct answer: Delays the start of that scenario relative to the test start

    With several scenarios you can run, say, a background load from 0s and a spike scenario starting at startTime: '5m'.

  10. 10. What does exec set in a k6 scenario?

    Correct answer: The name of the exported function that this scenario runs

    Without exec, scenarios run the default function. With it, a browse scenario and a checkout scenario can run different code in parallel.

  11. 11. What does this threshold do?

    thresholds: {
      http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true, delayAbortEval: '30s' }],
    }

    Correct answer: Stops the test early if errors exceed 1%, but not in the first 30 s

    abortOnFail ends the run as soon as the threshold fails, saving time and protecting the system. delayAbortEval waits so early noise doesn't abort it.

  12. 12. How do you set a threshold for only one endpoint?

    Correct answer: Tag its requests and use a sub-metric like http_req_duration{name:search}

    Thresholds on tagged sub-metrics apply only to matching samples. You can have strict targets for search and looser ones for reports.

  13. 13. Which custom k6 metric type fits measuring a duration with percentiles?

    Correct answer: Trend

    Trend keeps values and gives min, max, avg, median and percentiles. Counter sums, Gauge keeps the last value, and Rate gives a share of non-zero values.

  14. 14. Why load a big CSV of users with SharedArray?

    Correct answer: The data is loaded once and shared, instead of a copy in every VU

    Each VU is a separate JS runtime. A normal array is copied into each of them, which with 1000 VUs can use gigabytes of memory.

  15. 15. Where in a k6 script can you call open() to read a file?

    Correct answer: Only in the init context, outside the default function

    File reads happen during init, when k6 prepares each VU. Calling open() in VU code throws an error.

  16. 16. What does http.batch() do?

    Correct answer: Sends several requests in parallel from one VU

    Batch imitates a browser loading several resources at once. Requests run in parallel up to the batch and batchPerHost limits.

  17. 17. A login endpoint should return 401 for wrong passwords in your test. How do you keep it out of http_req_failed?

    Correct answer: Mark 401 as expected: http.setResponseCallback(http.expectedStatuses(200, 401))

    The response callback decides which statuses count as success for http_req_failed and the expected_response tag.

  18. 18. Why set discardResponseBodies: true in a large k6 test?

    Correct answer: To save generator memory when you don't need to read the bodies

    k6 still receives the bytes, but doesn't keep them. For requests that need the body, set responseType: 'text' on that request.

  19. 19. How does a protocol-level k6 test differ from a browser-level test?

    Correct answer: It sends HTTP requests directly and doesn't render pages or run page JS

    Protocol tests are cheap and generate lots of load on servers. Browser tests (k6 browser) measure what users see, like Web Vitals, but use far more resources per VU.

  20. 20. When does a hybrid test with a few browser VUs and many protocol VUs make sense?

    Correct answer: To see real page metrics while the backend is under heavy load

    The protocol scenario creates the load. A few browser VUs measure the frontend experience at that load without needing thousands of browsers.

  21. 21. Two generators report p95 = 200 ms and p95 = 400 ms. Is the overall p95 300 ms?

    Correct answer: Not necessarily: percentiles can't be averaged, merge the raw data

    Percentiles depend on the whole distribution. Combine raw samples or mergeable histograms (e.g. HdrHistogram), then compute p95.

  22. 22. A test sent 200 requests and reports p99.9. How reliable is that value?

    Correct answer: Not reliable: with 200 samples p99.9 is basically the maximum

    p99.9 means 1 in 1000. You need thousands of samples for the high percentiles to mean something.

  23. 23. What does the USE method check for each resource?

    Correct answer: Utilization, Saturation and Errors

    For CPU, memory, disk, network and pools: how busy it is, how much work is waiting, and how many errors. It finds bottlenecks quickly.

  24. 24. Why does latency grow sharply as a resource approaches 100% utilization?

    Correct answer: Queues grow non-linearly as utilization approaches full

    In queueing models, waiting time grows like 1/(1−ρ). At 50% the wait is modest. At 90% and above, small load increases cause huge delays.

  25. 25. What does Amdahl's law say about scaling?

    Correct answer: The serial part of the work limits the speedup from more resources

    If 10% of the work can't be parallelized, the speedup can never exceed 10×. Shared locks and single DB writers are typical serial parts.

  26. 26. Under load, timeouts trigger client retries, and traffic doubles. What is this called?

    Correct answer: A retry storm that amplifies overload

    Retries without backoff and limits multiply load just when the system is weakest. Use exponential backoff, jitter and retry budgets.

  27. 27. What is load shedding?

    Correct answer: Rejecting part of the requests early to keep the rest fast

    A server that knows it can't serve everything returns fast errors (often 503 or 429) instead of making every request slow. A stress test should show this works.

  28. 28. During a spike test, autoscaling adds servers, but errors happen in the first minutes. Why?

    Correct answer: New instances take time to start and warm up, so the spike hits first

    Scaling reacts to metrics with a delay, and new instances need to boot and warm caches. Spike tests reveal this gap; pre-scaling or buffers close it.

  29. 29. Why run a test both with a cold and a warm cache?

    Correct answer: Real traffic sees both, and a cold start can be much slower

    After a deploy, a cache flush or a failover, caches are empty. A test that only measures a warm cache misses that worst case.

  30. 30. The test hits the site through a CDN. What do you measure for static assets?

    Correct answer: Mostly the CDN, not your origin servers

    Cached assets are served from CDN edges. To test origin capacity, test it directly or use cache-busting carefully; and check the CDN's rules about load tests.

  31. 31. In a soak test, logins start failing after 1 hour. What is a typical test-side cause?

    Correct answer: Auth tokens expire and the script doesn't refresh them

    Short tests never reach token expiry. A soak script must handle refresh or relogin, or its failures say nothing about the system.

  32. 32. What does k6 do with HTTP connections by default?

    Correct answer: Reuses them per VU with keep-alive, like a browser

    Connection reuse is realistic for most clients. noConnectionReuse forces new connections, which tests TLS handshake cost and connection limits.

  33. 33. All load comes from one IP address through a load balancer with sticky sessions. What can go wrong?

    Correct answer: All traffic can land on one backend, so the others sit idle

    IP-based stickiness or rate limits per IP behave differently than with real, varied clients. Use several generators or IPs, or check the LB settings.

  34. 34. Which JMeter element helps keep a target throughput instead of a fixed number of threads?

    Correct answer: A Constant Throughput Timer

    It delays threads to reach a target samples-per-minute. It can only slow things down: you still need enough threads to reach the rate.

  35. 35. What is the CSV Data Set Config in JMeter for?

    Correct answer: Reading rows of a CSV file into variables for each thread

    Each thread reads the next row and uses the values as variables, e.g. ${username}. Sharing mode controls how threads split the file.

  36. 36. How do you pass a token from a login response to the next request in JMeter?

    Correct answer: Extract it with a JSON or Regular Expression Extractor into a variable

    Post-processors parse the response and store values as variables. The next sampler uses them, e.g. Bearer ${token}.

  37. 37. In Gatling, what is the difference between constantUsersPerSec and constantConcurrentUsers?

    Correct answer: The first is an open model (arrivals), the second a closed model

    Gatling separates open injection (users arrive at a rate) from closed injection (keep N users). Mixing them in one population isn't allowed.

  38. 38. What is a feeder in Gatling?

    Correct answer: A source of test data, like a CSV file, for virtual users

    Feeders provide records that each virtual user takes, for parameterized logins and IDs. Strategies like circular or random control the order.

  39. 39. In Locust, what does wait_time = between(1, 3) do?

    Correct answer: Makes each user wait 1-3 seconds between tasks

    It is think time. The number of users and the spawn rate are set when starting the test, not in the class.

  40. 40. In a soak test, memory grows steadily and GC pauses get longer. What does it suggest?

    Correct answer: A memory leak: objects are kept and never freed

    A healthy app plateaus after warm-up. Constant growth leads to longer GC, slower requests and finally out-of-memory crashes.

  41. 41. The new build's p95 is 8% higher than the baseline. What do you check first?

    Correct answer: Whether the gap is bigger than the usual run-to-run variance

    Compare against the spread of several baseline runs. Inside the noise means nothing. A stable, repeated increase is a regression to investigate.

  42. 42. How does distributed tracing help during a load test?

    Correct answer: It shows which service or call inside a slow request took the time

    A trace breaks one request into spans across services. Under load you can see whether time goes to a DB, a queue or a third-party API.

  43. 43. What does an Apdex score express?

    Correct answer: User satisfaction based on how many responses meet a time target

    Apdex = (satisfied + tolerating/2) / total, with a target time T. It gives one 0-1 number, but hides the distribution.

  44. 44. Why tie load test targets to the SLO and error budget?

    Correct answer: So results show whether the service keeps its real promise

    If the SLO is 99.9% of requests under 300 ms, the test should check exactly that at peak load. Targets made up for the test don't connect to real risk.

  45. 45. Under load, requests wait for a free worker thread while CPU stays low. What is saturated?

    Correct answer: The thread pool

    A small pool with blocking I/O can run out of threads long before the CPU is busy. Look at pool queue length and wait time.

  46. 46. Why is it hard to load test an asynchronous flow (API accepts, a worker processes later)?

    Correct answer: The HTTP reply is fast, but the real work happens later

    A 202 in 20 ms says nothing about processing time. Measure queue lag and time to completion, e.g. by polling or reading timestamps.

  47. 47. A soak test creates 1 million orders. Why can this distort later runs?

    Correct answer: Growing tables make queries slower than in a clean environment

    Data volume changes query plans, index sizes and backup times. Reset data between runs, or deliberately test with the expected data size.

  48. 48. What does pacing mean in a load test?

    Correct answer: Controlling the total time per iteration, not just the pause

    With pacing, an iteration starts every N seconds regardless of how fast the requests were. It keeps the rate per user stable when response times vary.

  49. 49. What happens to concurrency if you cut think time from 5 s to 1 s at the same RPS?

    Correct answer: Fewer concurrent users are needed for the same RPS

    Users = RPS × (response time + think time). Shorter pauses mean each user sends more requests, so you need fewer of them. Real session counts may differ.

  50. 50. Why may a load test against a service hit its own rate limiter first?

    Correct answer: Its traffic comes from few IPs or keys, which limits catch

    A test may measure the limiter, not capacity. Agree whether limits are part of the test, or use allowlisted keys, and check 429s in results.

  51. 51. The generator logs "cannot assign requested address" at high load. What is the likely cause?

    Correct answer: The generator ran out of local ports or file descriptors

    Many short connections use up ephemeral ports or the open-file limit. Tune OS limits, reuse connections, or spread load over more machines.

  52. 52. Why is TLS handshake cost often noticeable in load tests without connection reuse?

    Correct answer: Each new TLS connection needs extra round trips and CPU

    With keep-alive the handshake happens once per connection. If every request opens a new connection, server CPU and latency grow. k6 shows it in http_req_tls_handshaking.

  53. 53. What changes when a test uses HTTP/2 instead of HTTP/1.1?

    Correct answer: Many requests share one connection, so fewer connections

    HTTP/2 multiplexes streams on one TCP connection. Load per connection and server behaviour differ, so the protocol should match what real clients use.

  54. 54. The average latency is 200 ms, but the histogram shows two peaks: 50 ms and 800 ms. What does it suggest?

    Correct answer: Two different paths, e.g. cache hits and misses

    A bimodal distribution means two populations. The average falls between them and describes neither. Split metrics by tag or path.

  55. 55. Why is standard deviation a weak summary for latency?

    Correct answer: Latency has a long tail and isn't normally distributed

    Latency has a hard lower limit and a long right tail. Percentiles describe it better than mean ± standard deviation.

  56. 56. The system calls a payment provider. Should the load test hit the real provider?

    Correct answer: Usually not: stub it and test the real one separately

    Third parties may charge, block you or have their own limits. A stub with realistic latency keeps the test about your system. Check limits of the real one separately.

  57. 57. Does a k6 HTTP test download images and CSS referenced by an HTML page?

    Correct answer: No: only the requests the script makes explicitly

    k6 HTTP is protocol-level. To include assets, add those requests (often with http.batch) or use the browser module.

  58. 58. How do you make two runs of the same test comparable?

    Correct answer: Same data, environment, script, load shape and tool version

    Every difference in the setup can change results. Keep the setup fixed and record it with the results.

  59. 59. In JMeter distributed mode, what does the controller do?

    Correct answer: Sends the plan to worker machines and collects their results

    Workers (formerly slaves) generate load. All of them run the same plan, so a Thread Group of 100 with 3 workers means 300 threads.

  60. 60. What does a Synchronizing Timer in JMeter do?

    Correct answer: Holds threads until N are ready, then releases them at once

    It creates bursts of simultaneous requests, useful for race conditions or spike behaviour on one endpoint.

  61. 61. How can k6 results be shown in Grafana dashboards in real time?

    Correct answer: Through an output, e.g. Prometheus remote write or InfluxDB

    With --out experimental-prometheus-rw or other outputs, metrics stream to a time series DB, next to server metrics.

  62. 62. What does handleSummary() in k6 let you do?

    Correct answer: Customize the end-of-test summary and write it to files

    It receives all summary data and returns outputs, e.g. JSON for CI, an HTML report or a JUnit file.

  63. 63. Why run a test at 120-150% of the expected peak?

    Correct answer: To have headroom for growth, bad estimates and failover

    Peaks are estimates, and losing a node or zone moves its traffic to others. Headroom tells you how much margin you have.

  64. 64. During a test of 10 minutes, one endpoint's p95 is fine, but errors cluster in one minute. What do you do?

    Correct answer: Look at a time series, not only the summary, and match it to events

    A summary averages over the run. A time view shows bursts from deploys, GC, cron jobs or autoscaling that you need to explain.

  65. 65. When testing WebSockets, what should you measure besides connection time?

    Correct answer: Message latency and how many connections stay open stably

    WebSocket load is about many long-lived connections and message flow. Track connect errors, drops, message round-trip time and server memory per connection.

  66. 66. How do you test a cache stampede scenario?

    Correct answer: Expire a hot key and send many requests for it at once

    When a popular key expires, many requests may hit the DB at once. The test checks whether locking, request coalescing or stale-while-revalidate protect the DB.

  67. 67. Why are load tests often written as code (k6, Gatling, Locust) rather than recorded?

    Correct answer: Code can be reviewed, versioned and run in CI

    Recordings capture one session with hard-coded values. Code makes data, correlation and scenarios explicit and maintainable.

  68. 68. What is a bad sign in a stress test even if the system recovers after load drops?

    Correct answer: It took many minutes to recover or needed a manual restart

    Good degradation fails fast and recovers on its own. Slow recovery points to stuck queues, leaked connections or retry loops.

  69. 69. What is the main risk of running k6 with thousands of VUs on one laptop?

    Correct answer: The laptop's CPU, memory or network becomes the limit

    Monitor generator CPU and memory. k6 docs recommend tuning the OS and splitting very large tests across machines or using a cloud service.

  70. 70. Why should load test reports include the configuration, not just numbers?

    Correct answer: Numbers mean little without the load shape, data and environment

    "p95 = 300 ms" at 50 RPS on a staging box and at 2000 RPS in prod are different facts. State version, load, duration, data and infra.

  71. 71. What does a rising http_req_blocked in k6 indicate?

    Correct answer: Time waiting for a free connection or socket is growing

    http_req_blocked is time before the request starts, e.g. waiting for a TCP slot or DNS. Growth points to connection limits on the client side.

  72. 72. A test of a search endpoint uses the same 10 queries. What is the risk?

    Correct answer: Query and DB caches make search look faster than with real queries

    Real users search for many different terms. A small set of repeated queries mostly measures cache hits.

  73. 73. What does a load test of the database layer alone not tell you?

    Correct answer: How the whole request path behaves, including app and network

    DB benchmarks are useful for capacity, but the bottleneck may be in the app, pools or other services. End-to-end tests are needed too.

  74. 74. Which phases of a request does k6 include in http_req_duration?

    Correct answer: http_req_duration covers sending, waiting and receiving only

    Connection setup is reported separately in http_req_blocked, http_req_connecting and http_req_tls_handshaking. With reused connections those are near zero.

  75. 75. Why is a test that only hits GET /products a weak capacity test for a shop?

    Correct answer: Writes, checkout and search compete for the same resources

    A realistic workload model mixes reads and writes in production proportions. Writes take locks and use the DB differently, which changes the bottleneck.

  76. 76. What is the difference between ramping-vus and ramping-arrival-rate?

    Correct answer: The first changes the number of VUs, the second the iteration rate

    ramping-vus is a closed model with VU stages. ramping-arrival-rate is an open model with stages of iterations per time unit.