# Eight agent sessions, six MCP servers: measuring what a shared gateway saves (/blog/eight-sessions-six-servers)

An agent session that uses a local (stdio) MCP server starts its own copy of it, so memory grows with sessions before any tool is called. In the 2026-11-16 run, eight sessions took 3,163 MiB in 56 processes on their own and, behind one gateway, 847 MiB with every server running and 103 MiB while idle.

Published 2026-12-03 by William Monroy.

An agent session that uses a local (stdio) server starts its own copy of it: in the [stdio transport](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio), the client launches the server as a subprocess. Counting the whole process tree under each server, each session in the 2026-11-16 runs with installed binaries added seven processes: 28 with four sessions, 56 with eight.

The benchmark measures what that costs with six public servers and eight sessions, once with each session starting its own servers and once behind the [gateway](/docs/concepts/gateway) of turno, a tool for switching accounts in coding agents: one local process, `mcpd`, that every agent session reaches and that starts each MCP server once.

<Bench title="Memory with 8 sessions and 6 MCP servers" unit="MiB" better="lower" scale="log" rows={[{"label":"each session starts its own","note":"56 processes","value":3163,"tone":"base"},{"label":"turno, all servers running","note":"8 processes","value":847},{"label":"turno, idle","note":"1 process","value":103}]} method="Each session runs initialize and tools/list on every server; memory is the sum of the RSS of every process involved, read from ps three seconds after the last session connected." env="Apple M3, 16 GB, macOS, Node 26.13" runs="one run" measured="2026-11-16" reproduce="/docs/benchmarks" caption="On a log scale, since the idle gateway is about a thirtieth of the direct setup." />

In that run, the one in the results table of [Benchmarks](/docs/benchmarks), the gateway used 73% less memory while every server ran and 97% less while they were idle. In two eight-session reruns on 2026-11-30 the setups stayed apart: 2,879 and 2,751 MiB direct, 659 and 405 MiB through the gateway with every server running.

## The setup [#the-setup]

The script, `bench/mcp-ram.mjs`, installs six servers that start without an API key into a temporary folder, at pinned versions: `@playwright/mcp` 0.0.85, `chrome-devtools-mcp` 1.13.0, `@modelcontextprotocol/server-filesystem` 2.3.0, `@modelcontextprotocol/server-memory` 2.1.1, `@modelcontextprotocol/server-sequential-thinking` 2.1.1 and `@upstash/context7-mcp` 4.7.0.

It then measures three setups with simulated sessions:

| Setup | What runs |
| --- | --- |
| Direct | every session starts every server over stdio, as a plain `mcpServers` entry does |
| turno, all servers running | one `mcpd` with an empty tool cache: each server starts once to learn its tools and stays up for every session |
| turno, idle | `mcpd` restarted with the tool lists the first round cached: no server starts until a tool is called |

The gateway runs in a throwaway `HOME`; the script never reads or changes your turno or agent configuration.

The 2026-11-16 files do not record the turno version. The 2026-11-30 files, committed with the [fixed script](https://github.com/wimo-dev/turno/blob/eb57508/bench/mcp-ram.mjs), record turno 0.6.3, the load average, and the memory of `mcpd` and of each server with its child processes.

## Four sessions against eight [#four-sessions-against-eight]

The 2026-11-16 run:

| Sessions | Direct | Processes | turno, running | Processes | turno, idle | Processes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| 4 | 1,410 MiB | 28 | 692 MiB | 8 | 101 MiB | 1 |
| 8 | 3,163 MiB | 56 | 847 MiB | 8 | 103 MiB | 1 |

In that run direct memory more than doubled from four sessions to eight, and the process count doubled exactly. Behind the gateway the count stayed at 8 and memory rose from 692 to 847 MiB; idle, it went from 101 to 103 MiB. That day's two four-session gateway runs differed by 52 MiB: 692 and 640 MiB, the second in the `--npx` run, which changes only the direct setup.

## Where the gateway's memory is [#where-the-gateways-memory-is]

The 2026-11-30 reruns split it. The eight processes are `mcpd`, five servers with one process each and `chrome-devtools-mcp` with two, as it has per copy when started from the installed binary. The machine was shared with other sessions. Every server running:

| Run | Sessions | Load, 1 min | `mcpd` | Six servers | Total |
| --- | ---: | ---: | ---: | ---: | ---: |
| [4-sessions](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-30-m3-16gb-4-sessions.json) | 4 | 91.37 | 61 MiB | 348 MiB | 409 MiB |
| [4-sessions-npx](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-30-m3-16gb-4-sessions-npx.json) | 4 | 51.5 | 71 MiB | 594 MiB | 665 MiB |
| [8-sessions](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-30-m3-16gb-8-sessions.json) | 8 | 84.66 | 96 MiB | 563 MiB | 659 MiB |
| [8-sessions-run-2](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-30-m3-16gb-8-sessions-run-2.json) | 8 | 59.28 | 59 MiB | 346 MiB | 405 MiB |

"Six servers" is the total minus `mcpd`. Each pair, near 400 and near 660 MiB, holds one four-session and one eight-session run, and every server was larger in the pair near 660 MiB. `mcpd` stayed between 59 and 96 MiB. At this noise level the reruns do not show growth from four to eight sessions, and most of the spread is in the servers.

<Aside label="Through npx">
The script's `--npx` flag starts each server through `npx -y`, which BENCHMARKS.md says most server READMEs suggest. Started that way on 2026-11-16, four sessions took 3,123 MiB in 52 processes, about what eight took with installed binaries that day.
</Aside>

## What the numbers leave out [#what-the-numbers-leave-out]

RSS counts a shared page once in every process that maps it, so these sums overstate real pressure for both setups.

The benchmark only starts the servers and lists their tools, which every session pays even if it never calls them. A server that opens a browser or indexes files uses much more memory once a tool runs.

A browser that one agent drives at a time should run as a `shared` server with `exclusive = true`, one Chrome per [browser identity](/docs/browser/identities) (a persistent Chrome profile that an agent drives); other servers that keep state per conversation can use `scope = "session"` ([Scopes](/docs/concepts/scopes)). Both give back part of the saving on purpose.

Each 2026-11-16 figure is one run, and the two eight-session reruns differed by 254 MiB through the gateway, so a difference of that size should not be read as a change.

## What came after [#what-came-after]

[turno-cli 0.2.0](/releases/cli/0-2-0) made the cost visible on your own machine: `turno mcp top` shows each running server's memory with its child processes, and `turno mcp savings` compares `mcpd` and its servers with an estimate of the same sessions without the gateway.

The same release shortens the idle limit when memory is short: a shared server normally stops after 30 minutes without a call, and under memory pressure after `idle_under_pressure`, 5 minutes by default, or a quarter of that when the pressure is critical. As of turno-cli 0.6.4:

```ts title="packages/turno/src/mcpd/pressure.ts"
export function effectiveIdle(idle: number, level: PressureLevel, underPressure: number): number {
  if (!(underPressure > 0) || level === "normal") return idle;
  const limit = level === "critical" ? Math.max(1, Math.round(underPressure / 4)) : underPressure;
  return Math.min(idle, limit); // [!code highlight]
}
```

The limit only gets shorter, and `false` turns the feature off.

[turno-cli 0.3.0](/releases/cli/0-3-0) also stops a quiet `session` server under critical pressure while its session lives; the next call starts it again.

## Run it yourself [#run-it-yourself]

These numbers come from one machine, and the script is written for macOS: it reads the machine's model and memory with macOS `sysctl` keys. The script on main opens its sessions the way the gateway expects since turno-cli 0.2.0 ([pull request 215](https://github.com/wimo-dev/turno/pull/215)). Its `SERVERS` list is easy to edit, and `turno mcp list` shows what you run:

```sh
git clone https://github.com/wimo-dev/turno
cd turno
pnpm install && pnpm build
pnpm bench:mcp-ram --sessions 8 --out bench/results/mine.json
pnpm bench:mcp-ram --sessions 4 --npx
```

## Sources [#sources]

- [`BENCHMARKS.md`](https://github.com/wimo-dev/turno/blob/eb57508/BENCHMARKS.md) and [Benchmarks](/docs/benchmarks).
- [`bench/mcp-ram.mjs` at eb57508](https://github.com/wimo-dev/turno/blob/eb57508/bench/mcp-ram.mjs). The first version of the script and the 2026-11-16 results came with [commit 08ee890](https://github.com/wimo-dev/turno/commit/08ee890).
- 2026-11-16 results, Apple M3, 16 GB, Node 26.13: [4 sessions](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-16-m3-16gb-4-sessions.json), [8 sessions](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-16-m3-16gb-8-sessions.json), [4 sessions through npx](https://github.com/wimo-dev/turno/blob/eb57508/bench/results/2026-11-16-m3-16gb-4-sessions-npx.json).
- 2026-11-30 results, Apple M3, 16 GB, macOS 27.2.1, Node 26.13, turno 0.6.3: the four files linked in the table above.
- [`pressure.ts`](https://github.com/wimo-dev/turno/blob/turno-cli%400.6.4/packages/turno/src/mcpd/pressure.ts) and [`CHANGELOG.md`](https://github.com/wimo-dev/turno/blob/turno-cli%400.6.4/packages/turno/CHANGELOG.md) at turno-cli@0.6.4; release pages [0.2.0](/releases/cli/0-2-0) and [0.3.0](/releases/cli/0-3-0).