Skip to content

Reduce repeated tool-list checks for concurrent runs of one agent - #6243

Draft
markstuart-oai wants to merge 1 commit into
mainfrom
perf/share-tool-snapshot-checks
Draft

markstuart-oai wants to merge 1 commit into
mainfrom
perf/share-tool-snapshot-checks

Conversation

@markstuart-oai

Copy link
Copy Markdown
Contributor

Summary

In an offline replay of 32 overlapping text requests on one Agent, this change has been cutting median latency per caller by 17.7% (11.88 to 9.70 ms) and p95 by 5.5%. On main, each caller has been comparing the live tool list with every active caller's list on every read.

The patch has been checking every snapshot under the existing lock on registration. After a successful check, readers have been comparing the live tool identities and their order with one snapshot. Readers have been falling back to the full scan after an interrupted registration or a conflict. Each run has been keeping its own context and approval state.

Test plan

Two regression tests have been covering a join after a conflict and an interrupted registration. Both have been checking rejection after restoring the original list.

The full Agents verifier on Linux and Python 3.12 with the stock client has been passing 12,872 tests, with 30 skips. Formatting, linting, Pyright and mypy have been passing.

The text workload has been using an empty tool list and a local model returning a prebuilt reply. With eight callers, median latency has been falling by 5.2%. With one caller, the interval has been spanning zero.

In a second offline workload, each caller has been sending a distinct input and running one tool between two model replies. The tool has been changing a context variable. Each caller has been checking its own output and context afterward.

Callers Tools available Main median per caller Patch median per caller Paired change and 95% interval
1 1 1.64 ms 1.64 ms +0.52% [−0.29, +0.76]
8 1 9.07 ms 8.83 ms −2.74% [−3.44, −1.99]
32 1 36.07 ms 32.07 ms −11.76% [−12.62, −10.65]
32 8 45.12 ms 38.26 ms −15.11% [−15.72, −14.44]

The tool benchmark has been using 36 balanced blocks with the patch and two identical main controls. All four p95 intervals against the first control have been spanning zero.

With the public Responses client and intercepted HTTP, 32 callers have been seeing smaller gains. The first 24 blocks have been showing median reductions of 7.28% for text and 2.75% for one tool. Both p95 intervals have been spanning zero and +3%.

In a fresh 192-block replay, the text median has been falling by 5.62% [4.99, 6.14] and the one-tool median by 2.46% [1.85, 3.08]. Text p95 has been changing by −2.80% [−5.56, −1.01] and one-tool p95 by +0.12% [−2.35, +2.84]. Request bodies, tool effects, outputs and caller contexts have been matching main. These tests have been excluding network and inference time.

For one tool, the second stock control has been running 0.36% slower at the median. The patch has been running 2.72% faster than that control.

The broader offline run has been using Python 3.12 with openai==3.59.0, Codex off, and 6afdd47b as the baseline. All 83 median upper bounds have been staying below +3%. The comparisons have been using 32 process pairs or a fresh 64-pair follow-up. I have been reporting the median percentage change within pairs and bootstrapping whole pairs for each 95% interval.

In eight cases, the individual 95% intervals have been showing small increases. The estimates have been ranging from 0.38% to 1.18%, with the largest on a reused stream. For retained history, the larger replay has been showing a 0.44% increase for the patch and 0.48% between identical main builds.

In a separate profile, two of those eight workloads have been making zero calls to the changed functions during measurement. The other six have been reaching them with a single reader. This has been leaving the cause of those small increases uncertain.

In a separate one-tool startup check, 36 blocks using distinct package paths have been suggesting a 2% slowdown. Across 192 fresh blocks using one path for all builds, the first-answer changes have been +0.69% [−0.39, +1.54] and +0.06% [−0.83, +1.17] against the two stock controls. Warm median and p95 upper bounds in this replay have been staying below +1.1%.

Of 47 p95 estimates, four have been showing initial upper bounds above +3%. In a separate 192-pair replay, all four have been staying within the threshold. That replay has also been comparing identical copies of main.

Workload p95 change in the follow-up 95% interval
Build an agent with 12 tools and a settings dictionary −0.72% −1.47% to +0.43%
Build an agent with 12 tools and default settings −0.76% −1.44% to +0.17%
Mark one item as sent with 2,048 retained items +0.55% −1.05% to +1.44%
Four tool turns −0.38% −0.96% to +0.13%
All 83 median comparisons
Suite Workload Pairs Main, ms Patch, ms Paired change 95% interval
Holdout cold_normal 32 62.444 62.669 +0.47% −0.51% to +1.35%
Holdout cold_stream 32 245.862 246.749 −0.17% −1.62% to +1.79%
Holdout ids_17x32769 32 66.590 63.252 −4.03% −5.57% to −1.45%
Holdout ids_17x32769_stream 32 87.293 86.531 +0.23% −2.63% to +0.96%
Holdout ids_3x8193 32 5.658 5.627 −0.54% −1.05% to +0.01%
Holdout ids_3x8193_stream 32 8.019 7.962 −1.60% −2.69% to +0.59%
Holdout reuse_normal 32 38.519 38.516 +1.10% −0.46% to +1.72%
Holdout reuse_stream 32 40.272 40.496 +1.18% +0.04% to +1.94%
Holdout typed_3x257 32 5.523 5.429 −0.42% −2.24% to +0.83%
Holdout typed_3x257_stream 32 6.997 6.997 −0.03% −1.39% to +0.67%
Round 1 add_tool 32 1.716 1.718 +0.10% −0.21% to +0.45%
Round 1 build_dict_12 32 0.0522 0.0523 −0.11% −0.47% to +1.12%
Round 1 build_omitted_12 32 0.0705 0.0708 +0.04% −0.81% to +1.04%
Round 1 build_typed_12 32 0.0390 0.0391 +0.57% +0.01% to +0.98%
Round 1 con1 32 0.4993 0.5001 +0.25% −0.64% to +1.15%
Round 1 con32 32 11.877 9.695 −17.73% −18.47% to −17.19%
Round 1 con8 32 2.850 2.707 −5.17% −5.74% to −4.45%
Round 1 diag_32 32 11.970 9.857 −17.72% −18.12% to −17.27%
Round 1 h128 32 1.266 1.256 −0.47% −0.91% to +0.06%
Round 1 handoffs_0 32 0.5082 0.5047 −0.69% −1.41% to +0.28%
Round 1 handoffs_12 32 0.7122 0.7110 −0.10% −0.50% to +0.48%
Round 1 history120 32 0.9271 0.9265 −0.16% −0.48% to +0.43%
Round 1 history2000 32 6.137 6.174 +0.39% −0.16% to +0.90%
Round 1 history720 32 2.695 2.694 −0.10% −0.38% to +0.84%
Round 1 mixed_6 32 0.7225 0.7239 +0.16% −0.50% to +1.00%
Round 1 nested67_stream16 32 74.174 73.835 +0.18% −1.05% to +0.93%
Round 1 repeat_8 32 0.9984 1.006 +1.03% +0.42% to +1.30%
Round 1 retained_16384 32 0.2064 0.2009 −0.82% −4.30% to +0.67%
Round 1 retained_2048 32 0.0294 0.0296 +0.91% +0.47% to +1.18%
Round 1 run_dict_6 32 0.7767 0.7792 +0.54% +0.06% to +1.08%
Round 1 run_omitted_6 32 0.8398 0.8377 +0.16% −0.55% to +0.51%
Round 1 run_typed_6 32 0.7435 0.7438 +0.56% −0.72% to +1.15%
Round 1 schemas_24 32 0.8590 0.8596 +0.09% −0.25% to +0.41%
Round 1 server_1 32 1.803 1.810 +0.31% −0.30% to +0.98%
Round 1 server_1024 32 20.826 20.704 −0.47% −1.21% to +0.34%
Round 1 server_128 32 4.376 4.362 −0.20% −0.91% to +0.16%
Round 1 server_512 32 11.405 11.334 −0.58% −1.10% to +0.38%
Round 1 single_0 32 0.5033 0.5029 +0.13% −0.34% to +0.51%
Round 1 single_12 32 0.5938 0.5954 +0.68% −0.57% to +1.07%
Round 1 stream 32 0.7813 0.7795 +0.05% −0.79% to +0.93%
Round 1 sustained_32 32 11.768 9.693 −17.96% −18.36% to −17.47%
Round 1 time_1024_4096 64 51.205 50.681 −1.34% −4.84% to +1.02%
Round 1 time_16384_2 32 0.4093 0.4099 +0.33% −0.17% to +0.57%
Round 1 time_2048_2 32 0.0581 0.0583 −0.01% −0.13% to +0.36%
Round 1 time_2_256 64 6.370 6.405 −2.27% −8.50% to +1.97%
Round 1 time_4096_8 32 0.4383 0.4382 −0.04% −0.26% to +0.33%
Round 1 tools1 32 1.610 1.603 −0.32% −1.05% to +0.12%
Round 1 tools16 32 19.187 19.184 +0.16% −0.51% to +0.62%
Round 1 tools4 32 4.632 4.627 −0.04% −0.50% to +0.29%
Round 1 warm 32 0.4903 0.4902 −0.55% −1.11% to +0.43%
Round 2 batch-compare 1x1024 32 21.153 21.113 −0.46% −1.01% to +0.46%
Round 2 batch-compare 2x32 32 3.738 3.746 +0.04% −0.20% to +0.29%
Round 2 bulk-live 12x64 32 16.718 16.764 −0.03% −0.38% to +0.26%
Round 2 bulk-live 1x1024 32 21.035 21.070 −0.14% −0.68% to +0.15%
Round 2 bulk-live 1x2048 32 40.205 40.086 −0.07% −0.77% to +0.40%
Round 2 bulk-live 1x256 32 6.872 6.859 +0.08% −0.41% to +0.61%
Round 2 combo5 4x1024 32 44.462 44.556 +0.16% −0.26% to +0.76%
Round 2 combo5 8x128 32 36.475 36.728 +0.54% −0.35% to +1.18%
Round 2 concurrent5 2x128 64 410.229 409.220 +0.13% −0.43% to +0.41%
Round 2 first-final 1x0 32 1234.274 1233.808 −0.12% −0.71% to +0.29%
Round 2 first-mcp 1x0 32 1235.455 1234.607 −0.16% −0.60% to +0.44%
Round 2 lists-final 1x1024 32 5.308 5.307 −0.12% −0.47% to +1.14%
Round 2 lists-final 8x8192 32 35.098 35.114 −0.64% −1.58% to +1.00%
Round 2 provider-final 1x2048 32 261.121 263.847 +0.86% +0.36% to +1.34%
Round 2 provider-final 1x4096 32 516.105 519.735 +0.84% +0.41% to +1.16%
Round 2 quote-final 1x1 32 1.725 1.725 +0.02% −0.16% to +0.34%
Round 2 quote-final 1x64 32 2.605 2.610 +0.08% −0.29% to +0.37%
Round 2 quote-final 8x16 32 11.592 11.649 +0.38% +0.07% to +0.83%
Round 2 quote-final 8x256 32 37.097 37.100 −0.23% −0.54% to +0.36%
Round 2 quote-final 8x64 32 16.853 16.862 +0.09% −0.17% to +0.42%
Round 2 shape-local normal 12x96 32 34.891 34.881 +0.03% −0.66% to +0.78%
Round 2 shape-local stream 12x96 32 56.372 56.297 −0.30% −0.88% to +0.34%
Round 2 shape-local stream 4x12 32 11.491 11.516 −0.18% −0.50% to +0.25%
Round 2 shape-local stream 8x0 32 14.431 14.524 +0.09% −0.64% to +0.72%
Round 2 tail 4x1024 64 43.713 43.734 +0.07% −0.18% to +0.24%
Round 2 values-final ids 1x1 32 1.675 1.679 +0.07% −0.50% to +0.39%
Round 2 values-final ids 8x8192 32 12.882 12.829 −0.67% −0.96% to +1.16%
Round 2 values-final last 4x512 32 6.127 6.126 −0.09% −0.56% to +0.24%
Round 2 values-final records 8x512 32 11.386 11.315 −0.21% −0.74% to +0.23%
Round 2 values-final typed 16x1024 32 27.195 27.223 −0.17% −1.14% to +0.80%
Round 2 values-final typed 4x128 32 5.100 5.112 +0.22% −0.42% to +0.44%
Round 2 warm-control 1x0 32 1.735 1.728 +0.05% −0.33% to +0.42%
Round 2 warm-control 1x4096 32 35.033 35.112 +0.32% −0.63% to +0.97%

Checks

  • Public regression tests
  • Full .agents/skills/code-change-verification/scripts/run.sh
  • Passing repository checks
  • Independent review of conflict handling and test results

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant