Running one MCP server per CPU core: restarts were the hard part, not scaling

Mailbox-MCP · reddit · 2026-10-10

A hosted email MCP provider details running one Node process per CPU core behind nginx. Four pitfalls: (1) dozens of idle streams from Claude/ChatGPT kept server.close() from finishing — now shutdown takes under 0.1s; (2) rejected connections triggered up to 47 retries per second, fixed by systemd socket activation so the kernel queues connections during restarts (200/200 requests survived a proof run), though rollback requires stopping the socket too; (3) the TS SDK handler ends when the client hangs up but tools keep running — count in-flight tool calls; (4) two copies refreshing the same OAuth token risks invalidgrant with rotating refresh tokens, fixed with sticky nginx routing plus a token re-read retry. Their busiest hour only uses 10% of the event loop.

Original post →

More from coding & agent

coding & agent channel →