# Servers ran short of CPU as the network grew, slowing new connections for 19 hours

> As traffic climbed on the evening of Oct 25, the servers that relay traffic between devices ran short of CPU and held their database connections far longer than the database needed, until up to 11,462 requests were waiting for one. From 19:00 new connections slowed and some failed, worst for our hosted proxy service, and no alert fired for seven and a half hours. A fix at 03:15 cut the failures by three quarters, and the queue drained at 14:07 on Oct 26 as limits on each service's database connections rolled out.

Started Oct 25 19:00 UTC; ended Oct 26 14:07 UTC, 19 h 07 min. Worst level: Degraded.
https://ur.io/outages/2026-10-25-2

Our network has grown fast: 203,000 connected clients, the identities apps and devices use on our network, on Oct 26, against 67,000 on Oct 23. From about 19:00 on Oct 25, as evening traffic climbed, the servers that relay their traffic ran short of CPU. Starved servers held each database connection they borrowed for about 14 milliseconds where the database needed 1 to 2, so all 640 connections of the connection pooler, which shares database connections between our servers, were busy, and up to 11,462 requests waited for one. New connections slowed and some failed. A device needs a contract before it can send traffic through a provider, and until 03:30, 5.3% of the contracts our hosted proxy service asked for failed, up to 420 a second while server updates rolled out. No alert fired, and we found it at 02:25. A fix at 03:15 cut the failures by three quarters, and the queue drained at 14:07 on Oct 26, as limits on each service's database connections rolled out.

## Phases

| From (UTC) | To (UTC) | Level | What people saw |
|---|---|---|---|
| Oct 25 19:00 | Oct 26 14:07 | Degraded | New connections and contracts were slower and some failed, most often for our hosted proxy service; after a fix at 03:15 the failures fell by three quarters, to a few a second, until 14:07. |

## Key moments

- ~Oct 25 19:00: As evening traffic climbs, the servers that relay it run short of CPU. Requests start to queue for database connections, and new connections slow down.
- Oct 25 20:47: A planned server update rolls out during the slowdown. At about 21:10, as its old processes finish draining, their clients reconnect at once, and hosted proxy failures jump to 129 a second.
- ~Oct 25 23:00: A second update drains four relay groups together from 22:44. Their clients reconnect at once, failed hosted proxy requests pile up retrying their cleanup, and failures peak at 420 a second.
- Oct 25 23:32: A routine check of our metrics sees the hosted proxy failures and takes them for the noise of the update. It doesn't look at the queue for database connections.
- Oct 26 00:05: The queue peaks: 11,462 requests are waiting for a database connection.
- Oct 26 02:25: The next check compares hosted proxy failures with the evening's and finds them rising, seven and a half hours after the slowdown began. No alert had fired.
- Oct 26 02:30: We find the database nearly idle, waiting on the servers that hold its connections, and trace the queue to servers starved of CPU and to the load balancer in front of the pooler.
- Oct 26 03:15: We fix the load balancer so that every worker takes its share of connections, and move the old workers' connections over by 03:25. Waiting requests fall from about 3,900 to about 1,500, and failures by three quarters.
- Oct 26 05:53: The pooler's reserve connections can now open before a waiting request is dropped.
- Oct 26 13:29: Limits on each service's database connections, and fixes that cut needless database work, roll out to our hosted proxy service. By 14:07 the queue has drained and failures are back to normal.

## Who was affected

- **Hosted proxy customers.** From 19:00 to 03:30, 5.3% of the 7.56 million contracts our hosted proxy service asked for failed, with peaks of 129 a second at 21:10 and 420 a second at 23:00, and by 02:30 a new contract took about 2 seconds. After the 03:15 fix, failures fell by three quarters, to a few a second, and stayed there until 14:07.
- **People using the apps and our API.** Connections that were already open kept working, and the number of connected clients kept rising. New connections were slower, and until 03:30, 0.6% of the contracts our API created failed, with peaks of 24 a second.
- **Data.** No data was lost. Database work that was abandoned or dropped was rolled back.

## What went wrong

- **Our relay servers ran out of CPU as the network grew.** From 19:00, the servers that relay traffic between devices ran 77–90% busy, and work waited for a free core 30–48% of the time. The relay's cost per message had not changed; the network had grown. From Oct 23 to Oct 26, connected clients tripled, from 67,000 to 203,000, the messages the relay carries grew from 250,000 to 3.4 million a second, and the relay's CPU use grew from 28 cores to 183. The servers' network stacks strained too, retransmitting tens of thousands of packets a second.
- **CPU-starved servers held database connections they weren't using.** Each piece of database work holds one of the pooler's connections from start to finish. The database did its part in 1 to 2 milliseconds, but servers waiting for CPU held each connection for about 14, so at any moment most connections sat idle, waiting on the server that held them. All 640 were busy, and requests waited about 54 milliseconds for one, up to 11,462 at a time. The pooler kept 128 reserve connections for this, but it opened them only after a request had waited 5 seconds, and it dropped requests that had waited 4, so the reserve never opened, and every dropped request reconnected and added to the load.
- **The load balancer in front of the pooler piled connections onto a few workers.** Connections to the pooler pass through a load balancer that spreads them across the pooler's 32 processes. Its 32 workers shared one listening socket, and whichever worker woke first took every waiting connection, so 4 workers held 61% of its 14,500 connections while most held fewer than ten. The busiest used 71% of a core, and requests through it waited their turn. The simplest query took 0.07 milliseconds on the database itself, 7.4 through the pooler and 10.9 through the load balancer.
- **Two updates and duplicate checks made it worse.** We rolled out two server updates during the slowdown. As each one's old processes finished draining, their clients reconnected at once, and hosted proxy failures spiked to 129 a second at 21:10 and 420 a second at 23:00. The second spike was more than reconnects: four relay groups drained together, and 75,600 failed requests piled up in our hosted proxy service, each retrying its cleanup for up to five minutes. It was the same flaw that had failed hosted proxy requests that afternoon, and that caused the next afternoon's outage. Checks that each connection's session is still valid made up about 40% of the pooler's work, about 17,000 a second, and the relay checked every connection twice a minute where once is enough. Contract creation and other updates to the same client records also waited on each other's locks.
- **Nothing alerted us for seven and a half hours.** No alert watched the queue for database connections, the share of contracts that fail, or our servers' CPU pressure. A routine check of our metrics at 23:32 saw the hosted proxy failures, took them for the noise of the update, and didn't look at the queue. We found the slowdown at 02:25, when the next check compared the failures with the evening's.

## What we changed

- Done (2026-10-26): The load balancer in front of the pooler gives each worker its own listening socket, so new connections spread evenly, and a configuration reload now moves connections to the new workers gracefully. The average wait for a database connection fell from 54 to 39 milliseconds, and hosted proxy failures from about 20 a second to 3 to 7.
- Done (2026-10-26): The pooler opens its reserve connections after half a second of waiting, before it would drop a waiting request, and each of its processes has two more connections, within the database's limit.
- Done (2026-10-26): Each service has a cap on the database connections it can hold, so no one service can fill the pooler.
- Done (2026-10-26): The relay checks each connection's session once a minute instead of twice, about 3,400 fewer database transactions a second.
  - [urnetwork/server@4f963d6](https://github.com/urnetwork/server/commit/4f963d634f12): Refresh session hints on the corrective pass without rechecking every lease
- Done (2026-10-26): The relay does less work per message: idle connections between relay servers send a keepalive every 10 seconds instead of every second, where keepalives had been three quarters of their messages, and each relay process schedules its work on fewer cores, where scheduling had taken about 40% of its CPU.
  - [urnetwork/server@606dd8c](https://github.com/urnetwork/server/commit/606dd8c424a7): Ping idle exchange connections every 10 s instead of every second
- Done (2026-10-26): About 230 database writes a second that changed nothing are skipped; each hosted proxy contract had spent 0.13 to 0.21 seconds waiting on them. Creating a contract takes a lighter lock on client records, so it no longer waits behind unrelated updates to them.
  - [urnetwork/server@41db3d5](https://github.com/urnetwork/server/commit/41db3d5978e2): Skip network_client writes that would change nothing
  - [urnetwork/server@fb9ae96](https://github.com/urnetwork/server/commit/fb9ae9621f97): Lock network_client FOR KEY SHARE at the contract boundary and in key custody

## Still open

- More capacity for the relay, or moving relay work to servers with room to spare. Until then, we roll out relay updates only when nothing is queued for the database, and slowly enough to spread out the reconnects.
- Check the remaining sessions in batches: one database read per server for all of its due checks, instead of one per connection.
- Alerts that page us when contracts start failing, requests queue for the database, or our servers run short of CPU.

Published 2026-10-26; last updated 2026-10-29.
