AC-053 Scenario caught CS-RESP-014

The server gets slower with every call

Time and unstable servers

How to run this card's commands yourself

1. The problem

In one sentence

Each call takes longer than the one before, because of a leak, a growing queue, a cache that fills or a resource that is never released.

A story

After a restart, an endpoint answers in about 100 ms. An hour later it takes 500 ms. By the end of the day it takes five seconds. Each call is correct. A one-time check, run right after a deploy, sees a fast server. The slow-down shows only over many calls, and ends with a restart that “fixes” it, until the cycle starts again.

Why it hurts

A server that degrades under use passes every short test and fails in production. The failure is the trend, and a single measurement does not show a trend.

  • For developers: the usual causes are memory or connection leaks, an unbounded in-memory structure, or a table that grows without an index. A heap or connection graph shows it.
  • For managers: the service “works after a restart”, and the fix is scheduled restarts. The real fault stays, and so do the surprises when traffic grows.
  • For DevOps: keep a soak test: a steady load for a long time, with the response time recorded per minute. Watch the trend, not just the average.

Example

A sandbox route whose delay grows with each call (about 100 ms, then 300 ms more for each following call, up to a cap). A limit of 850 ms on each call:

call 1   about 116 ms    within the limit
call 2   about 404 ms    within the limit
call 3   about 705 ms    within the limit
call 4   about 1008 ms   over the limit
call 5   about 1313 ms   over the limit

How to detect it without clrsig

  • Call the route in a loop and print %{time_total} for each call, then look at the trend.
  • Plot the response time over a long run, and compare the first and the last hour.

How to fix it

There are two usual causes:

  1. The code leaks (more likely). Find the resource that grows (memory, connections, a queue) and release it, or bound it.
  2. The budget is wrong or the load changed. More data per call, or more callers, can slow a correct system. Then plan capacity.

To tell which: restart and compare. If it is fast again, something accumulates. Never schedule restarts as the fix.

AC-048 The server is slow, AC-049 The server never answers, or answers too slowly in the body, AC-050 The server fails every few calls.

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, for each call that is over the limit. clrsig does not detect a trend by itself (the known gap CS-GAP-005): a call that is slower than the one before but still under the limit passes. A scenario with repeated calls and a duration assertion shows the point where the limit is crossed.

Command

Save the scenario below as degrading.yaml. It sends one POST (the sandbox reset) and five GET requests, each with a duration assertion of less than 850 ms:

Safety. Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.

schemaVersion: "1"
title: latency grows with every call
steps:
  - label: reset
    request: { method: POST, url: "{{baseUrl}}/__admin/reset" }
    assertions:
      - { type: status, operator: eq, expected: 204 }
    failPolicy: stop
  - label: call 1
    request: { method: GET, url: "{{baseUrl}}/latency/degrading" }
    assertions:
      - { type: duration, operator: lt, expected: 850 }
    failPolicy: continue
  - label: call 2
    request: { method: GET, url: "{{baseUrl}}/latency/degrading" }
    assertions:
      - { type: duration, operator: lt, expected: 850 }
    failPolicy: continue
  - label: call 3
    request: { method: GET, url: "{{baseUrl}}/latency/degrading" }
    assertions:
      - { type: duration, operator: lt, expected: 850 }
    failPolicy: continue
  - label: call 4
    request: { method: GET, url: "{{baseUrl}}/latency/degrading" }
    assertions:
      - { type: duration, operator: lt, expected: 850 }
    failPolicy: continue
  - label: call 5
    request: { method: GET, url: "{{baseUrl}}/latency/degrading" }
    assertions:
      - { type: duration, operator: lt, expected: 850 }
    failPolicy: continue
clrsig run degrading.yaml \
  --env clrsig/environments/conform-fail.yaml \
  --spec specs/conform-fail.yaml

Exit code: 0 all steps pass, 1 a step failed, 2 the scenario or the setup is broken. Here it is 1.

What you see

Output from clrsig v0.21.0, recorded on 2026-11-30. Times vary from run to run:

Scenario: latency grows with every call

  PASS  reset  204  21ms
         ✓ status eq 204
  PASS  call 1  200  102ms
         ✓ duration lt 850 ms
  PASS  call 2  200  404ms
         ✓ duration lt 850 ms
  PASS  call 3  200  703ms
         ✓ duration lt 850 ms
  FAIL  call 4  200  1003ms
         ✗ duration lt 850 ms: the response took 1003 ms; expected lt 850 ms
  FAIL  call 5  200  1303ms
         ✗ duration lt 850 ms: the response took 1303 ms; expected lt 850 ms

Spec: 1 of 6 responses were not compared with the spec (no matching operation in the spec: 1)
FAILED  4 passed, 2 failed, 0 skipped  (4/6 assertions passed)  3547ms

How to read it: the time rises with each call (116, 404, 705, 1008, 1313 ms), and the limit of 850 ms is crossed at call 4. The first three calls pass, and each is slower than the one before.

Where to look

  • Desktop app: open the scenario and run it; each step shows its duration and assertion.
  • Reports: --format json and junit on clrsig run. The Contracts page records each operation’s last and slowest response time.
  • GitHub Action: use command: run with the scenario, env and spec inputs; spec replaces the scenario’s specFile. Older releases of the Action ignored spec with run; if you use one, add specFile: specs/conform-fail.yaml to the scenario instead (the path is relative to the scenario file) (setup and upgrading).

How clrsig helps you fix it

It shows the sequence of times and where the limit is crossed. It does not say why.

Limits

  • A trend that stays under the limit is not reported (CS-GAP-005). The numbers are in the output; read them.
  • Wall-clock limits fail on a busy machine: leave a margin. A scenario of five calls is a hint, not a soak test.

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-053 · The server gets slower with every call
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: a server that degrades under use passes every short test; the failure is the trend, and one measurement does not show a trend.
Open with this story: After a restart, an endpoint answers in about 100 milliseconds. An hour later it takes 500. By the end of the day it takes five seconds. Each call is correct. A one-time check right after a deploy sees a fast server. The slow-down shows only over many calls, and ends with a restart that fixes it, until the cycle starts again.
Say these facts, in this order:
1. The sandbox route gets slower with each call. The scenario calls it five times and asserts each call takes under 850 milliseconds.
2. The times are about 116, 404, 705, 1008 and 1313 milliseconds. Calls 1 to 3 pass; calls 4 and 5 fail.
3. Each call is slower than the one before, including the passing ones; that is the trend.
4. clrsig does not detect a trend by itself; a call that is slower but still under the limit passes. This is a known gap, CS-GAP-005.
5. Two usual causes: the code leaks (memory, connections, an unbounded queue), or the load changed and capacity must grow.
6. To tell which: restart and compare. Never schedule restarts as the fix.
7. For managers: the service works after a restart, and the real fault stays.
8. For DevOps: keep a soak test with response time recorded per minute, and watch the trend.
Show on screen: the five times, the scenario YAML, the command (clrsig run degrading.yaml --env clrsig/environments/conform-fail.yaml --spec specs/conform-fail.yaml), and the output block, copied exactly from the card.
Name the check: CS-RESP-014, Response slower than the limit, here through a duration assertion; the trend itself is the known gap CS-GAP-005. Say the clrsig version: v0.21.0.
Explain these words once: leak (a resource that is taken and never given back); trend (a change over time); soak test (a long test under steady load); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: a trend that stays under the limit is not reported; a scenario of five calls is a hint, not a soak test.
Safety line (if a write is shown): Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.
Finish with three recap questions:
1. Why does a check right after a deploy miss this? (The server is still fast then.)
2. At which call does the limit get crossed? (Call 4.)
3. What is the real fix? (Find and release the resource that accumulates, not scheduled restarts.)
Tease the next video: AC-054 · A spec change breaks existing clients.
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.