mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

Release request: ship #1812 and #1813 (v0.72.0 spends ~89 s per held tool on a ~3,000-tool fleet)

Open antongulin opened this issue 3 weeks ago • 2 comments

Production numbers from v0.72.0 that match #1724. As far as I can tell, #1812 (scoped registry view) and #1813 (per-server capture lock) fix both problems below. Both are on main but not in a tag yet. Could they go out in a patch release (v0.72.1 or the next minor)? I'm happy to test an rc.

Setup

  • v0.72.0, Linux container, 4 vCPU, no Docker scanners (in-process baseline only), embedded TPA bundle.
  • 84 upstreams, about 3,000 tools. trust_mode: 50 auto, 14 manual, 20 scan/default.
  • Several manual servers are the same HTTP connector behind different credentials, so they expose identical 18-tool sets. Every new one is flagged detect.shadowing.cross_server, which is expected.

What we saw

  1. Per-tool cost scales with the fleet. Each held tool of a newly added manual server took about 89 s of one core. The log showed one tool definition scan returned a non-green verdict line about every 89 s and nothing in between. An 18-tool server needed about 27 minutes before its tools could be approved. Right after a proxy restart, while most peers were still connecting, the same scans took 10–20 s each. That fits ScanToolMetadataVerdict running every check over the whole registry view for each single tool.
  2. One server's scans stall the others. While one server's held tools were being scanned, an unrelated, fully approved server whose upstream header had changed stayed in Tool capture incomplete: tool calls for the server are refused until a complete capture is applied for about 7 minutes. Its Tool capture complete line came 1 s after the other server's last scan line. Another server in the same state stayed refused for about 30 minutes. This looks like the runtime-wide captureSnapMu that #1813 splits.
  3. Held tools are re-scanned on every pass. A manual server with 4 held tools re-ran its evidence scans every pass, about 6 minutes per pass, which kept the core at 100–114% CPU.

Workaround

PATCH /api/v1/config with {"security":{"auto_rescan_on_change":false}}. It hot-reloaded with no restart and no reconnects, and CPU dropped from about 100% to 17% within a minute. The scan-mode gate scan is a separate path and still pays the full cost, so this is only partial relief until #1812 ships.

Thanks for the quick fixes on main.

antongulin avatar Nov 07 '26 02:11 antongulin

Thanks for the precise report — the diagnosis is right. #1812 and #1813 are in v0.73.0, published now: https://github.com/smart-mcp-proxy/mcpproxy-go/releases/tag/v0.73.0 (also on the desktop update channel and Homebrew).

I reproduced your fleet shape locally before tagging (85 HTTP upstreams / 3,042 tools, in-process scanner, 50 auto / 14 manual / 20 scan, several manual servers sharing an identical 18-tool set) and measured v0.72.0 against the RC on the same fixture:

v0.72.0 v0.73.0-rc.2
Startup informational baseline scan, 67 servers 15 min (9–18 s per server, serial) 30 s
New manual server with 18 tools identical to peers (detect.shadowing.cross_server on all 18): per-tool held scan 8.5 s per tool, 2.5 min for the server; the approve call blocked for the whole time 19 ms per tool, 0.34 s for the server; approve returned in 1 s
Idle CPU with held tools, between discovery passes 0.5–0.8 % 0.5–0.8 %
5-minute discovery pass with held tools ~60 % CPU for a minute (8 s per re-scanned tool) 6.8 % for 30 s (3 re-scans in 1 s)
Goroutines / RSS over 12 min with held tools flat (393) / ~200 MB flat (390→392) / ~215 MB

The per-tool cost no longer scales with the fleet: peers are index context only (#1812), so item 1 and item 3 collapse together. Item 2's cross-server stall is the lock #1813 splits; the approve-blocked-behind-scans symptom above is the same lock. Your auto_rescan_on_change: false workaround is safe to keep or revert — on the RC the informational rescan is cheap either way.

If you can run v0.73.0 on the 84-upstream fleet, a before/after of tool definition scan returned a non-green verdict cadence from your logs would be a good confirmation.

Dumbris avatar Nov 07 '26 16:11 Dumbris

Closing, since #1812 and #1813 shipped in v0.73.0. If the numbers on your 84-upstream fleet do not match the table above, please comment here and I will reopen.

Dumbris avatar Nov 11 '26 14:11 Dumbris