Where the time goes

In shortMeasured time 10xGraph and the API add on top of the model call, by load level and by stage, with storage calls per run and engine-only numbers.

  • 10 min read
  • 8 sections
  • Updated
  • v1.0.0
  • Markdown

We measured how much time 10xGraph adds on top of the model call. Every request made two model calls of 2.0 s and one tool call of 0.3 s, so each had a floor of 4.30 s. On one CPU with 10 concurrent users, 10xGraph and the API added 96 ms at the median (2.2 percent of the floor) and 178 ms at p99. With 100 users the median was 188 ms (4.4 percent) and p99 was 1,387 ms, because the single CPU was busy and requests queued. These numbers are for this setup only; see Limits of these numbers.

Setup

Item Value
Model A mock server (LLMock), not a real model. 2 calls of 2.0 s per request.
Tool 1 call per request, 0.3 s
Floor 2.0 + 0.3 + 2.0 = 4.30 s per request
API One Uvicorn process limited to 1 CPU and 2 GiB, MODE=production
Auth JWT with the tenant claim org_id, role-based access
Storage PgCheckpointer (Postgres with a Redis cache), Redis cache store with rate limit and token revocation
Events and logs One RabbitMQPublisher, audit log on, Prometheus metrics on
Load Closed loop: each virtual user sends a request, waits for the answer, then sends the next. Every user is its own user and every request starts a new thread.
Machine AMD Ryzen 5 5600G, 12 CPUs, 13 GiB RAM. Postgres 16, Redis 7.4 and RabbitMQ 4.1 ran on the same host without CPU limits. The load generator ran on the same host and Docker network.
Code 10xgraph and 10xgraph-api as of 2026-11-28: the 1.1 code before the version number was bumped, so both report 1.0.0. Uvicorn 0.54.0 with uvloop and httptools.
Run 30 s per load level, 10 to 500 users, on 2026-11-28

Overhead is the request latency minus the 4.30 s floor. It is everything that is not the model call or the tool call: the server, auth, rate limit, storage reads and writes, events and the audit log. The floor is the nominal delay. Direct calls to the mock took 2.022 s and 2.006 s, so a few tens of milliseconds of the overhead can be the mock itself.

The per-stage numbers below came from temporary timers in the code. They were in the build for this run and have been removed since.

Overhead by load level

This is the recommended Kubernetes server: one Uvicorn process per pod. The last three columns are a second run with Gunicorn and one Uvicorn worker, the recommended VM and Compose setup.

Users Requests/s Overhead p50 Overhead p99 Failed Gunicorn: p50 Gunicorn: p99 Gunicorn: requests/s
10 2.3 96 ms 178 ms 0 151 ms 198 ms 2.2
25 5.6 117 ms 391 ms 0 195 ms 369 ms 5.5
50 10.8 271 ms 689 ms 0 103 ms 825 ms 11.0
100 20.6 188 ms 1,387 ms 0 230 ms 1,294 ms 20.3
150 29.5 327 ms 1,782 ms 0 870 ms 1,964 ms 26.7
200 34.0 1,117 ms 2,622 ms 0 1,119 ms 2,711 ms 34.0
300 40.4 2,461 ms 5,404 ms 0 2,526 ms 5,839 ms 38.9
400 41.7 4,274 ms 9,077 ms 2 of 1,553 4,350 ms 9,612 ms 41.7
500 41.6 6,206 ms 13,825 ms 0 6,333 ms 13,719 ms 41.2

What the table shows:

  • p99 climbs first. It passes 1 s at 100 users and keeps rising. The median stays under 330 ms up to 150 users, then rises from 200 users.
  • One CPU is the limit. The API container used 3 percent of its CPU on average at 10 users, 61 percent at 100, 85 percent at 150 and 98 percent at 500. Requests per second stop rising at about 41 from 300 users. Past that point extra users only add waiting time.
  • Medians are noisy up to 150 users. The two runs differ by 168 ms at 50 users (271 ms and 103 ms) and by 543 ms at 150 users (327 ms and 870 ms), and the median does not rise smoothly. Read them as a range, not as exact values.
  • The two server setups agree from 200 users up, within a few percent on overhead and requests per second.
  • The two failures at 400 users were a closed connection seen by the client (ClientOSError and ServerDisconnectedError).

More workers or more pods add CPU, so this limit moves with them. See Choosing the server process for the four-server comparison and the server recommendation.

Where the time goes, by stage

These are means per request, not percentiles. The data has no per-stage percentiles.

We use the 10-user level as the closest to the raw cost of a request, and the 100-user level next to it to show the effect of queueing on one CPU. Each value is the total time of a timer divided by the number of successful requests (70 at 10 users, 700 at 100 users). Where a stage runs more than once per request, the value is the sum over its calls and the calls per request are listed.

Stages nest, so the rows do not add up. A stage marked “inside” is already counted in the stage above it. Each group below is read on its own.

API layer

Stage 10 users 100 users Notes
Everything before the route handler runs 4.2 ms 14.0 ms From the first middleware to the start of the handler. Contains the next three rows.
Inside: middleware chain 1.3 ms 4.1 ms Request id, rate limit and the other middleware. Includes the rate limit row.
Inside: rate limit check (Redis) 1.3 ms 4.1 ms
Inside: authentication and roles 2.4 ms 9.5 ms Verify the token, resolve roles, check revocation.
Inside: token revocation check (Redis) 2.3 ms 9.4 ms Almost all of the row above.
Prepare the run (API side) 12.1 ms 44.3 ms Input handling, thread checks, saving the thread. Runs before the graph starts.
Inside: save the thread (Postgres) 7.6 ms 18.3 ms
After the run: build the reply and write the audit log 0.5 ms 0.5 ms Post-run steps 0.29 ms, response build 0.06 ms, output build 0.02 ms, audit write 0.11 ms (2 events per request), at both levels.

Core engine

These stages run inside the graph call, which also holds the model and tool time.

Stage 10 users 100 users Notes
Start of the run 7.9 ms 63.2 ms Load the thread’s state, publish the start event, apply a resume. Contains the next row.
Inside: load the state 7.7 ms 63.0 ms
Complete the run 12.7 ms 29.7 ms After the last node: mark the run complete, run the end hook and save the final state.
Release the run 3.6 ms 10.3 ms After the run ends: stop the heartbeat and release the run’s stop scope in the checkpointer.
Check for a stop request (Redis) 1.8 ms 9.9 ms 4 calls per request: 0.46 ms and 2.47 ms each. Runs inside the node loop.
Build events for publishers 0.3 ms 0.3 ms 7 calls per request.

For the whole graph call (the time the API waits for the engine) minus the 4.30 s floor, the means were 80 ms at 10 users and 270 ms at 100 users. For the whole HTTP request the means were 97 ms and 330 ms. At 100 users the mean is well above the 188 ms median because a minority of requests wait much longer.

Storage and events

These timers sit inside the stages above, so they are already counted there.

Stage 10 users 100 users Notes
Save a checkpoint (Postgres) 35.2 ms 93.8 ms 4 saves per request: 8.8 ms and 23.5 ms each.
Save state to the Redis cache 5.2 ms 16.9 ms 8 saves per request: 0.64 ms and 2.11 ms each.
Send a batch of events to RabbitMQ 6.3 ms 12.0 ms 1.4 batch sends per request at 10 users, 0.9 at 100. Timed per batch send; the data does not show whether a send runs inside the request.

What is biggest

  • Saving checkpoints to Postgres is the largest single cost: 35 ms of the 96 ms median at 10 users, with four saves per request.
  • Starting and completing the run (loading state, final save) and preparing the run in the API (including saving the thread) are next, at 8 to 13 ms each at 10 users.
  • Auth and the rate limit are small at 10 users (about 2 ms and 1 ms), both mostly Redis round trips.
  • Under load, the same stages grow: loading the state went from 7.7 to 63.0 ms and token revocation from 2.3 to 9.4 ms. The likely reason is that these calls wait for the single CPU between steps, and that waiting is counted in the stage. The data does not separate waiting from working.
  • The remaining stages (input validation, authorization, run guard, resource id, response build) each cost 0.1 ms or less.

Storage calls per run

Counted per completed request at 10 users and 100 users (the same at the other levels, within a few percent).

Item 10 users 100 users
Postgres transactions per run 12.8 12.9
Redis commands per run 59.3 58.8
Postgres connections open 12 21

The Redis commands per run at 100 users, by command, with the mean time each call took inside Redis:

Command Calls per run Mean time per call
GET 22.7 1.1 µs
SETEX 9.0 2.0 µs
EVAL 9.0 39.8 µs
ZRANGE 4.0 1.2 µs
EVALSHA 2.0 35.7 µs
ZADD 2.0 3.4 µs
ZREMRANGEBYSCORE 2.0 2.0 µs
TIME 2.0 0.5 µs
PEXPIREAT 2.0 0.8 µs
ZCARD 2.0 0.3 µs
DEL 1.0 1.3 µs
ZREM 1.0 3.6 µs

The mean time per call is in microseconds, so the 1 to 3 ms stage times above are mostly network round trips and waiting, not work inside Redis. The Lua script commands (EVAL, EVALSHA) are the slowest per call.

Engine only: no API, no database

A 3-node graph of functions that do nothing, InMemoryCheckpointer, no model and no server. The time is for one ainvoke call on a thread that already holds the given number of messages. Measured on 2026-11-30 with the core benchmark test, as the median of 15 runs.

Messages already in the thread Time per run
1 1.5 ms
100 3.3 ms
1,000 15.9 ms

Before the 1.1 engine fixes, the 1,000-message run took 807 ms.

Limits of these numbers

  • One machine. One host ran the API, Postgres, Redis, RabbitMQ, the mock model and the load generator. A network between them adds time that is not in these numbers.
  • A mock model. There is no token streaming, no provider latency and no provider variance.
  • Invoke only. These runs used /v1/graph/invoke. We have no streaming numbers.
  • A new thread per request. Each request created a thread and saved it. Requests on existing threads with long history behave differently; see the engine-only table for the engine part.
  • One graph. Two model calls and one tool call. A graph with more steps pays the per-step costs (checkpoint saves, stop checks, events) more often.
  • Means for stages. The per-stage values are means, and the data has no per-stage percentiles.
  • Timers in the build. The temporary stage timers add a small cost of their own. The overhead percentiles come from the same runs.
  • Noise. Two runs of the same setup differ at the median up to 150 users, as the level table shows.
  • A one CPU limit. The 1 CPU limit sets where the p99 climbs. With more CPUs the same stages cost the same, and the climb moves to higher load.

Load-test your own graph, model and infrastructure before you size anything from this page.

Frequently asked questions

How much time does 10xGraph add to a request?
In our test on one CPU, 96 ms at the median and 178 ms at p99 with 10 concurrent users, and 188 ms at the median and 1,387 ms at p99 with 100 users. Each request made two model calls and one tool call, with a floor of 4.30 s.
Do these numbers include a real model?
No. The model was a mock with a fixed 2.0 s delay, so everything above the 4.30 s floor is time added by 10xGraph, the API and the storage behind them.
Last updated for v1.0.0Edit this page on GitHubReport an issue