Skip to content

mcp: improve lookup throughput - #142

Open
12458 wants to merge 5 commits into
facebookexperimental:mainfrom
12458:mcp-lookup-performance
Open

12458 wants to merge 5 commits into
facebookexperimental:mainfrom
12458:mcp-lookup-performance

Conversation

@12458

@12458 12458 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Blockeed awaiting #141 merge

  • Dispatch MCP tool calls concurrently on the shared Tokio runtime, with two in flight by default. Keep lightweight protocol requests responsive and serialize stdout writes.
  • Use a hash set to deduplicate indexed callers while preserving first-seen output order.
  • Stream the file and extractor-version columns for freshness checks. Stop on the first confirmed mismatch and preserve the rules for header routing, legacy rows, and empty indexes.

Benchmarks

Release builds against an existing Linux index with 1.09 million functions at 93f51579e7df. Each warm lookup trial used the same 16 symbols. The eight-request trials waited for the whole batch before issuing the next batch.

Change measured Workload Before After
Concurrent dispatch Warm lookups, batches of eight 12.3 lookups/s 24.9 lookups/s
Caller deduplication Warm lookups, batches of eight 24.5 lookups/s 68.9 lookups/s
Streaming freshness check Warm lookups, batches of eight 67.6 lookups/s 89.8 lookups/s
Streaming freshness check CPU time per lookup, batches of eight 73.0 ms 45.9 ms

Each row compares builds from its own benchmark run. Benchmarking preceded the move onto main. The caller deduplication and freshness comparisons checked that all 16 lookup responses were byte-identical across builds.

Validation

All 61 targeted tests passed on the PR branch.

cargo test --bin semcode-mcp --test schema_version --test scoped_indexing --test call_edge_versions
cargo fmt --check

Bound in-flight tool calls and run their handlers on blocking workers using the shared runtime. Keep protocol handling responsive and serialize writes to stdout.
Use hash-based membership checks as indexed callers are added, preserving their first-seen output order.
Read only processed file paths and extractor versions, comparing Arrow strings in batches and returning at the first mismatch. Reuse the scan during migration and preserve the legacy and empty-table cases.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 20, 2026
@12458 12458 changed the title Improve MCP lookup throughput mcp: improve lookup throughput Nov 20, 2026
@12458
12458 marked this pull request as ready for review November 23, 2026 01:21
@12458
12458 marked this pull request as draft November 23, 2026 01:27
@12458
12458 marked this pull request as ready for review November 26, 2026 13:02

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

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant