{"record":{"id":"2709c00de7b1e868","repo":"tursodatabase/turso","slug":"throughput-results-must-meet-a-positive-minimum-duration","errorCode":null,"errorMessage":"throughput results must meet a positive minimum duration","messagePattern":"throughput results must meet a positive minimum duration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"perf/fts/plot/plot-fts.py","lineNumber":137,"sourceCode":"\n\ndef read_measurement(row, percentile):\n    queries = int(row[\"queries\"])\n    positive_number(queries)\n    if row[\"benchmark\"] != \"memory\":\n        seconds = positive_number(row[\"seconds\"])\n    if row[\"benchmark\"] == \"memory\":\n        if row[\"engine\"] != \"turso\" or queries != int(row[\"requested_queries\"]) * int(row[\"connections\"]):\n            raise ValueError(\"heap results require Turso and the requested queries per connection\")\n        value = float(row[\"peak_heap_bytes\"]) / (1024 * 1024)\n    elif row[\"benchmark\"] == \"search\":\n        if not 0 < int(row[\"connections\"]) <= queries or queries != int(row[\"requested_queries\"]):\n            raise ValueError(\"search results require at least one sample per connection and the requested query count\")\n        value = float(row[f\"{percentile}_ms\"])\n    elif row[\"benchmark\"] == \"throughput\":\n        minimum = positive_number(row[\"min_seconds\"])\n        if seconds < minimum:\n            raise ValueError(\"throughput results must meet a positive minimum duration\")\n        value = queries / seconds\n    else:\n        raise ValueError(\"unknown benchmark\")\n    return positive_number(value)\n\n\ndef positive_number(value):\n    value = float(value)\n    if not np.isfinite(value) or value <= 0:\n        raise ValueError(\"measurements must be finite and positive\")\n    return value\n\n\ndef plot_sweep(configuration, points, output, relative=False):\n    import matplotlib\n\n    matplotlib.use(\"Agg\")\n    import matplotlib.pyplot as plt","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/perf/fts/plot/plot-fts.py#L119-L155","documentation":"Throughput rows must run for at least min_seconds; if the measured seconds is below the declared positive minimum, the queries/second figure is considered too noisy or invalid and the row is rejected.","triggerScenarios":"A throughput row where the seconds column is smaller than the row's min_seconds value (e.g. a run aborted almost immediately).","commonSituations":"Benchmark killed early; min_seconds raised after a short test run; clock/walltime recorded incorrectly by the harness.","solutions":["Re-run the throughput benchmark long enough to exceed min_seconds","Lower min_seconds in the row to match the actual run duration, if justified","Remove the too-short throughput rows from the CSV"],"exampleFix":"// before (CSV)\nbenchmark=throughput,seconds=2,min_seconds=10\n// after\nbenchmark=throughput,seconds=12,min_seconds=10","handlingStrategy":"validation","validationCode":"def validate_throughput_row(row):\n    if float(row[\"seconds\"]) < float(row[\"min_seconds\"]):\n        raise ValueError(\"throughput results must meet a positive minimum duration\")","typeGuard":"def is_long_enough(row) -> bool:\n    return float(row[\"seconds\"]) >= float(row[\"min_seconds\"]) > 0","tryCatchPattern":"try:\n    configuration, runs = read_runs(path, percentile)\nexcept ValueError as e:\n    print(f\"run too short: {e}\")","preventionTips":["Run throughput benchmarks well past min_seconds","Set min_seconds before the run and never below actual duration","Watch for aborted runs that stop early"],"tags":["python","benchmark","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"8d4a589f8d13ac184700d2a8f724f27e1995be3b","analyzedAt":"2026-09-20T13:18:14.658Z","contentChangedAt":"2026-09-20T13:18:14.658Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}