AC-048 Conformance caught CS-RESP-014

The server is slow

Time and unstable servers

How to run this card's commands yourself

1. The problem

In one sentence

The server answers correctly, but too slowly for the people and systems that depend on it.

A story

A report endpoint used to answer in 150 ms. After a new feature, it answers in 2 seconds. Every answer is right: valid status, valid body. A mobile app that calls it three times on one screen now takes six seconds to open. Users give up, and nothing in the logs shows an error.

Why it hurts

Speed is part of the contract even when the spec does not mention it. Clients have timeouts, users have patience, and each slow call adds to the next.

  • For developers: slowness grows quietly: an extra query, a missing index, a call to another service. Functional tests pass because the answer is right.
  • For managers: slow responses cost conversions and satisfaction long before they cost uptime. They are rarely counted as incidents, but customers feel them.
  • For DevOps: put a response-time budget on the operations that matter, per route, and check it after each deploy against a test environment. A long export may be allowed to take seconds; a login must not.

Example

Three operations in the sandbox, each with a deliberate delay. With a limit of 50 ms, all three are over it. With a limit of 1000 ms, all three are fine:

GET /latency/{ms}     answers after a fixed delay (200 ms here)
GET /latency/jitter   answers after a repeatable random delay
GET /latency/degrading   answers slower with each call

How to detect it without clrsig

  • curl -s -o /dev/null -w '%{time_total}\n' URL prints the total time of one request.
  • Look at percentiles (the 95th, the 99th) in your metrics, not only the average.

How to fix it

There are two usual causes:

  1. The code is slow (more likely). Find the query, the remote call or the loop that changed, and fix it. Add the budget to your tests so it does not come back.
  2. The budget is wrong. The operation is legitimately heavy. Then give it its own limit, and consider an asynchronous design (AC-046).

To tell which: compare with the time it took before the last change. Never raise a limit only to make a check pass.

AC-049 The server never answers, or answers too slowly in the body, AC-053 The server gets slower with every call, AC-050 The server fails every N calls (flaky).

Words used on this page are explained once in the glossary.

2. How clrsig helps

Check

CS-RESP-014 Response slower than the limit. State: caught (only when you set a limit). Severity today: failure (exit code 1). With --max-response-time <ms>, an operation whose response took longer fails with the finding slow-response. The response is kept and compared with the spec as well, so both problems are reported. Without an option nothing is timed.

--max-response-time-for /reports=2000 (repeatable) sets another limit for the operations under a path prefix. The longest matching prefix wins over the general limit, and 0 turns the limit off there.

Command

--paths limits the run to these three GET operations, so nothing is written. The sandbox was reset before each run, so the counters start from zero. A limit of 50 ms is far too tight for real use; it is chosen to show the finding:

clrsig conform specs/conform-fail.yaml \
  -b http://localhost:8080/conform-fail \
  --env clrsig/environments/conform-fail.yaml \
  --paths /latency/ --max-response-time 50 --explain

Exit code: 0 clean, 1 a finding, 2 the spec or the setup is broken. Here it is 1.

What you see

Output from clrsig v0.21.0, recorded on 2026-11-30. The lines for the 73 operations that --paths skipped are left out by grep -v '^ SKIP'; no line is edited. Times vary from run to run.

conform-fail API  1.0.0
Base URL: http://localhost:8080/conform-fail
Limited by --paths /latency/

  FAIL  GET     /latency/degrading  200  117ms
         ✗ GET /latency/degrading 200: the response was slower than the 50 ms limit
         → [CS-RESP-014] The response took 117 ms, over the limit of 50 ms. Why: The run was given a response-time limit and this operation answered more slowly. The response itself was still compared with the spec. Where: response time (spec: GET /latency/degrading). Fix: Make the operation faster, or raise the limit (--max-response-time) if the limit was too strict for this operation or this machine.
  FAIL  GET     /latency/jitter  200  164ms
         ✗ GET /latency/jitter 200: the response was slower than the 50 ms limit
         → [CS-RESP-014] The response took 164 ms, over the limit of 50 ms. Why: The run was given a response-time limit and this operation answered more slowly. The response itself was still compared with the spec. Where: response time (spec: GET /latency/jitter). Fix: Make the operation faster, or raise the limit (--max-response-time) if the limit was too strict for this operation or this machine.
  FAIL  GET     /latency/{ms}  200  205ms
         ✗ GET /latency/{ms} 200: the response was slower than the 50 ms limit
         → [CS-RESP-014] The response took 205 ms, over the limit of 50 ms. Why: The run was given a response-time limit and this operation answered more slowly. The response itself was still compared with the spec. Where: response time (spec: GET /latency/{ms}). Fix: Make the operation faster, or raise the limit (--max-response-time) if the limit was too strict for this operation or this machine.

FAILED  76 operations  ·  0 passed  ·  3 failed  ·  73 skipped  492ms

How to read it: each line gives the time that was measured and the limit. The message says the response itself was still compared with the spec, so a slow answer is not skipped.

With --max-response-time 1000 the same three operations pass (reset first):

Output from clrsig v0.21.0, recorded on 2026-11-30:

conform-fail API  1.0.0
Base URL: http://localhost:8080/conform-fail
Limited by --paths /latency/

  PASS  GET     /latency/degrading  200  123ms
  PASS  GET     /latency/jitter  200  164ms
  PASS  GET     /latency/{ms}  200  205ms

PASSED  76 operations  ·  3 passed  ·  0 failed  ·  73 skipped  500ms

Where to look

  • Desktop app: the Check Conformance page has a field for the slowest acceptable response, and one for response-time limits for paths.
  • Reports: with --format json, the finding carries "checkId": "CS-RESP-014" and the kind slow-response. The limit appears in the message, not the measured time, so a baseline stays stable.
  • GitHub Action: the max-response-time input, and max-response-time-for for limits per path. Older releases of the Action did not pass the second one to conform, without a message (setup and upgrading).
  • In a scenario: a duration assertion (operator: lt, expected in milliseconds) does the same for one step.

How clrsig helps you fix it

It names the operation, the time and the limit. It cannot find which part of the code is slow.

Limits

  • One request per operation: a single sample, not a percentile. A single slow call can be a bad moment on a busy machine, so leave a margin.
  • A response that is getting slower but is still under the limit is not reported (AC-053).

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-048 · The server is slow
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: speed is part of the contract even when the spec does not mention it; a correct answer that comes too late still breaks the experience.
Open with this story: A report endpoint used to answer in 150 milliseconds. After a new feature it answers in 2 seconds. Every answer is right. A mobile app that calls it three times on one screen now takes six seconds to open. Users give up, and nothing in the logs shows an error.
Say these facts, in this order:
1. With a response-time limit of 50 milliseconds, all three sandbox operations fail with the finding slow-response; with a limit of 1000 milliseconds, all three pass.
2. The response is still compared with the spec, so a slow answer is not skipped.
3. The check only runs when you set a limit; without an option nothing is timed. A different limit can be set for the operations under a path prefix, and zero turns the limit off there.
4. Slowness grows quietly: an extra query, a missing index, a call to another service. Functional tests pass because the answer is right.
5. Two usual causes: the code is slow (find the change and fix it), or the budget is wrong because the operation is legitimately heavy; then give it its own limit.
6. For managers: slow responses cost conversions and satisfaction long before they cost uptime.
7. For DevOps: put a response-time budget on the operations that matter, per route.
8. A limit of 50 milliseconds is far too tight for real use; it is chosen to show the finding.
Show on screen: the three operations, the command (clrsig conform specs/conform-fail.yaml -b http://localhost:8080/conform-fail --env clrsig/environments/conform-fail.yaml --paths /latency/ --max-response-time 50 --explain), and the first output block, copied exactly from the card.
Name the check: CS-RESP-014, Response slower than the limit. Say the clrsig version: v0.21.0.
Explain these words once: response time (how long a request takes from sending to the end of the body); latency (the delay before an answer); percentile (the time that most requests stay under, such as the 95th); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: it takes one sample per operation, not a percentile; a response that is slowly getting worse but is under the limit is not reported.
Safety line (if a write is shown): not needed, this command sends GET requests only.
Finish with three recap questions:
1. Does clrsig time responses by default? (No, only when you set a limit.)
2. Is a slow answer still compared with the spec? (Yes.)
3. Why not just raise the limit? (It hides the problem; fix the slowness or give the operation its own budget.)
Tease the next video: AC-049 · The server never answers, or answers too slowly in the body.
Do not: say "contract testing" alone; say clrsig "catches everything"; invent flags, IDs or numbers; read tables aloud; use any fact that is not in the card.