﻿# Between benchmark runs: verify cleanup instead of assuming the previous test stopped

A practical investigation of between benchmark runs: verify cleanup instead of assuming the previous test stopped, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-bench-between-run-cleanup-barrier/
Language: en

## The comparison being tested

A baseline benchmark reaches its deadline and the harness immediately starts the candidate. Some baseline requests remain queued or executing after the client stops waiting. The candidate inherits contention and is reported slower. Another candidate benefits from retained state. The experiment lacks a verified boundary between treatments, so independent run labels conceal overlapping application work.

## The confounding mechanism

Client cancellation and server cleanup are different transitions, as gRPC documentation makes explicit. Benchmark setup and teardown hooks also have defined invocation scopes rather than universal guarantees of drained asynchronous work. Returning from a harness function does not prove remote requests stopped, worker state reset or background preparation finished. Isolation must be observed at the boundaries relevant to the comparison.

## Fix the experimental contract

Define a bounded cleanup barrier: the run’s outstanding attempt inventory, expected terminal states and required resource conditions. Decide which state is intentionally retained for the target mode and which must be cleared. Preserve unresolved cleanup as a run-quality result. Do not erase all caches mechanically if the question concerns warmed service; controlled carryover and accidental interference are different experimental policies.

## A step-by-step comparison

Create synthetic runs with a request that deliberately outlives client waiting in an isolated test service. Check whether teardown waits for the declared barrier or records a bounded failure. Compare actual server work identities across run boundaries. Include a normal drained control and a retained-cache mode with explicit preparation. Verify that the next run does not begin under unexplained outstanding work from the previous treatment.

## Evidence required for the result

Acceptance evidence includes run identities, client stop times, cleanup observations and the next run’s start condition. Show unresolved requests and any excluded comparison blocks with their reasons. A fixed sleep may be a practical bound, but its expiry alone is not proof of drain. Repeat the relevant state check and retain uncertainty where the remote implementation does not expose cleanup completion.

## Interpretation and limits

This protocol does not guarantee zero background activity or require destructive production resets. It validates the isolation assumption of a bounded experiment. Missing resource observations can make a comparison inconclusive, and aborting one test may leave consequences needing separate recovery. Report that limitation instead of presenting the following candidate’s interference as an intrinsic performance characteristic of its runtime or model.

## Primary references and related reading

A finished client run is not a verified isolation barrier; confirm outstanding work and resource state before the next comparison. [gRPC cancellation guide](https://grpc.io/docs/guides/cancellation/); [Google Benchmark user guide](https://google.github.io/benchmark/user_guide.html).

The proposed investigation of between run cleanup barrier is not an executed deployment benchmark. Related reading: [Request cancellation: testing the full client-to-engine chain](/journal/provider-client-disconnect-cancellation-chain/); [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/).
