Skip to content

Parallelize RegistryToolLoader initialization for faster startup#1534

Merged
g2vinay merged 4 commits intomicrosoft:mainfrom
g2vinay:perf/parallelize-registry-tool-loader-initialization
Jan 27, 2026
Merged

Parallelize RegistryToolLoader initialization for faster startup#1534
g2vinay merged 4 commits intomicrosoft:mainfrom
g2vinay:perf/parallelize-registry-tool-loader-initialization

Conversation

@g2vinay
Copy link
Copy Markdown
Contributor

@g2vinay g2vinay commented Jan 20, 2026

Resolves #1026

perf: Parallelize RegistryToolLoader initialization to reduce startup time

This change addresses a ~20 second startup delay when running the Azure MCP
Server in VS Code via the VSIX extension.

Problem:
The RegistryToolLoader was sequentially initializing 47 MCP server processes
(one for each Azure service command group). With each server taking ~400-500ms
to start, the cumulative delay was 20+ seconds.

Change:

  • Parallelized server initialization using Task.WhenAll()
  • All servers now initialize concurrently instead of sequentially
  • Added comprehensive diagnostic logging with timing metrics

Performance Improvement:

  • Before: ~20,000ms (sequential initialization)
  • After: ~1,500-2,000ms (parallel initialization)
  • Speedup: 10-15x faster

The diagnostic logs now show:

  • Number of servers discovered
  • Success/failure counts
  • Total tools loaded
  • Precise initialization time

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Azure MCP Server startup performance by parallelizing external MCP server/client initialization in RegistryToolLoader and adding diagnostics/timing to help identify startup delays.

Changes:

  • Parallelized registry-discovered server initialization using Task.WhenAll.
  • Added initialization timing + summary logs (server count, success count, tool count, elapsed time).
  • Added a changelog entry describing the performance improvement.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
servers/Azure.Mcp.Server/changelog-entries/1769471477283.yaml Documents the startup performance improvement.
core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs Initializes MCP clients/tools in parallel and logs timing/summary metrics.

Comment thread core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs Outdated
…allelize-registry-tool-loader-initialization
Copy link
Copy Markdown
Member

@anuchandy anuchandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Vinay - just 2 minor comments for your review.

Comment thread core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs Outdated
Comment thread core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure MCP Server Jan 27, 2026
@g2vinay g2vinay merged commit 6ebc35a into microsoft:main Jan 27, 2026
70 of 72 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Jan 27, 2026
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] 20-second pause with no log events in server startup

3 participants