I Measured 27,257 MCP Connections. The p90 Session Waits 35s
Описание и применение
Удаление лишних MCP‑серверов и анализ логов сократили время подключения к среднему 550 мс, уменьшив длинный хвост до 3,4 с при отсутствии обновления токена.
Задача
MCP connections exhibit long tail latency, causing slow session starts and wasted developer time.
Результат
By disabling heavy MCP servers and focusing on OAuth refresh and transport choices, session start times dropped from a median of 582 ms to a more predictable 550 ms, with the p90 reduced from 3,678 ms to 3,400 ms for non‑refresh connections.
Рабочий процесс
- 1. Write a shell script to remove unnecessary MCP servers.
- 2. Collect JSONL logs from MCP servers over 35 days.
- 3. Pair "Starting connection" and "Connection established" lines to compute latency per connection.
- 4. Aggregate statistics: median, p75, p90, p95, p99.
- 5. Split data by token refresh occurrence to isolate OAuth impact.
- 6. Compare transport types (HTTP vs stdio) for median and tail latency.
- 7. Analyze per‑session fan‑out to assess cumulative connection time.
- 8. Identify servers with worst latency and remove them.
- 9. Cap measurements at client timeout (30s) to avoid skew from idle laptop.
- 10. Apply findings: count servers, make heavy ones opt‑in, prefer HTTP, review logs.
Доказательства
I wrote a 56‑line shell script called mcp-optional whose entire job was to remove two MCP servers from my config.
39% of connections take longer than a second, and the p99 is fourteen seconds.
5.8× slower. Same servers, same network, same machine. The only difference is whether the client had to go get a new access token first.
- Дата записи: 2026-09-21T00:45:38.175Z