You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(index): removal purge of a 320-tool server takes ~5.5 s (Spec 116 SC-004 budget 500 ms) #1617
Spec 116 SC-004 requires a removal whose index purge drops a 320-tool server to finish with p99 < 500 ms. It currently takes about 5.5 s, roughly 11 times the budget. The config commit holds configCommitMu for that whole time.
Measurement
internal/runtime/spec116_sc004_test.go (MCPPROXY_SC004_MEASURE=1, in-process, 25-server config, Apple M-series, PR #1612 branch):
Budget
Measured
commit, no index work: p99 < 50 ms
p99 20.0 ms (n=300)
removal with a 320-tool purge: p99 < 500 ms
p50 5.56 s, p99 6.26 s (n=40)
retirement of one connected instance: < 100 ms
p99 42 µs (Retire); removal commit p99 39.8 ms (n=40)
Cause
commitIndexPurge calls index.Manager.DeleteServerTools, which is BleveIndex.DeleteServerTools (internal/index/bleve.go). It runs one b.index.Delete(hit.ID) per tool, and each call is a separate bleve/bolt write transaction with its own fsync (about 17 ms each). This code predates Spec 116; PR #1612 does not touch internal/index.
A second issue in the same function: searchReq.Size = 1000 silently leaves the tools past 1000 in the index.
Suggested fix
Delete every hit in one index.NewBatch() / index.Batch(b), and page the search (or loop until no hits remain) so that servers with more than 1000 tools are fully purged. Re-run the SC-004 measurement afterwards and tick T098 in specs/116-config-commit-consistency/tasks.md.
Found while answering a review finding on #1612 (Spec 116 PR4, T098 / SC-004).
Activity
fix: close Sol round-4 gaps in the retirement barrier (Spec 116 PR4; #…
docs(spec116): tick T098 now that the batched tool purge meets SC-004 (…
fix(index): batch paged server tool purges (smart-mcp-proxy#1627)