Add parallel server launching with --parallel-launch flag #480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Gateway now launches MCP servers concurrently during startup. Previously, servers were launched sequentially during tool registration, causing O(n) startup latency. Parallel launching reduces this to O(max) with proper timeout handling preserved.
Changes
Command-line interface:
--parallel-launchflag (default:true)Server launching:
registerAllToolsParallel(): Launches each server in a goroutine, collects results via buffered channelregisterAllToolsSequential(): Preserves original sequential behavior when flag disabledlaunchResultstruct: Captures serverID, error, and duration from each launchsync.WaitGroupfor synchronization (no sleep-based waiting)Configuration:
ParallelLaunchfield toConfigstructImplementation
Log output includes per-server timing and success/failure counts:
Timeout handling inherited from existing
GetOrLaunch()implementation ensures individual server failures don't block gateway startup.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
nonexistent.local/tmp/go-build233922285/b269/launcher.test /tmp/go-build233922285/b269/launcher.test -test.testlogfile=/tmp/go-build233922285/b269/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true p/go-build(dns block)this-host-does-not-exist-12345.com/tmp/go-build233922285/b278/mcp.test /tmp/go-build233922285/b278/mcp.test -test.testlogfile=/tmp/go-build233922285/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 64/src/runtime/cgo 2xn6GOEZ9 x_amd64/compile(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.