Benchmarks
What the SDK gateway did in our own measurements: how many jobs per second a worker process drained, how long a job took from enqueue to completion, and how fast producers could enqueue. Capacity says what to size; this page is the data behind its numbers.
Read these as orders of magnitude
Everything ran on one shared machine: a container with 4 cores and 16 GB of memory ran the server instances, Redis, PostgreSQL, the producers and the workers at the same time, and other jobs shared it during the runs. The processor model and the instance type were not recorded. The handlers did nothing. So the numbers show how throughput moves with workers and instances, and what the gateway adds to a job. They are not what a production deployment does, and they are not a promise.
How it was measured
| Server | Release build, Crystal 1.22.2, CRYSTAL_WORKERS=4, with licensing bypassed as in the SDK conformance run |
| Data stores | Redis 7 and PostgreSQL 16, on the same machine, both empty and thrown away after the run |
| Machine | One shared container, 4 cores (nproc 4), 16 GB. Processor model and instance type: not recorded |
| Load | 3,000 jobs per run for the drain and enqueue rates; 100 jobs per second for 10 seconds for the latency |
| Jobs | No-op handlers. Each worker process runs 8 tasks at once |
| Repeats | 3 runs per configuration. Cells show the median; the drain rate also shows the range in brackets |
- Drain jobs/s: 3,000 jobs enqueued first, then the workers start. Completions per second from the first to the last
job.completedevent. With drain rates of several thousand jobs per second a 3,000-job backlog lasts under a second, so those cells move by 10 to 20 % between repeats. - Enqueue/s: how fast 8 producer threads stored those 3,000 jobs, one job per call (
POST /api/v1/sdk/jobs, round robin over the instances, every call audited). - p50 and p99: with the workers running, from just before each enqueue call to its
job.completedevent. - Direct Redis (Crystal): the same load through JoobQ's own Crystal worker, which talks to Redis with no gateway. It is the reference, not an SDK.
The harness is not published, so these results cannot be reproduced from this page. They were taken on the gateway as it was after the change described below (long polls woken by notifications, outcomes and heartbeats sent in batches); they were not re-run for the current release.
Gateway throughput
Worker processes against one or two server instances. Higher is better for jobs per second; lower is better for the latencies.
One server instance
| Worker | Processes | Drain jobs/s | Enqueue/s | p50 ms | p99 ms |
|---|---|---|---|---|---|
| Python | 1 | 2,680 (2,537–2,709) | 3,455 | 7 | 8 |
| Python | 2 | 4,260 (4,212–4,510) | 3,295 | 7 | 8 |
| Python | 4 | 5,234 (5,225–5,823) | 3,515 | 7 | 9 |
| Go | 1 | 2,656 (2,597–2,741) | 3,557 | 7 | 9 |
| Go | 2 | 4,798 (4,154–5,637) | 3,146 | 7 | 9 |
| Go | 4 | 5,595 (5,261–5,658) | 3,882 | 7 | 10 |
| TypeScript | 1 | 1,898 (1,815–2,215) | 3,247 | 7 | 13 |
| TypeScript | 2 | 2,906 (2,813–2,914) | 2,859 | 8 | 13 |
| TypeScript | 4 | 3,114 (2,590–4,397) | 2,524 | 7 | 15 |
| Java | 1 | 2,099 (1,930–2,305) | 2,970 | 7 | 15 |
| Java | 2 | 2,499 (2,409–2,690) | 2,863 | 8 | 15 |
| Java | 4 | 3,218 (2,895–3,467) | 3,646 | 7 | 14 |
| Crystal, direct Redis | 1 | 6,436 (6,436–6,664) | 22,372 | 41 | 91 |
| Crystal, direct Redis | 2 | 10,523 (10,098–10,635) | 20,384 | 41 | 90 |
| Crystal, direct Redis | 4 | 14,213 (14,146–14,418) | 20,559 | 40 | 90 |
Two server instances
| Worker | Processes | Drain jobs/s | Enqueue/s | p50 ms | p99 ms |
|---|---|---|---|---|---|
| Python | 1 | 2,695 (2,631–2,754) | 3,327 | 7 | 8 |
| Python | 2 | 4,026 (3,749–4,236) | 3,377 | 7 | 8 |
| Python | 4 | 4,982 (4,982–4,998) | 3,368 | 7 | 9 |
| Go | 1 | 2,606 (2,325–2,626) | 3,300 | 7 | 8 |
| Go | 2 | 3,925 (3,860–3,962) | 3,410 | 6 | 8 |
| Go | 4 | 5,243 (5,118–6,274) | 3,465 | 6 | 8 |
| TypeScript | 1 | 1,862 (1,835–1,867) | 3,265 | 7 | 9 |
| TypeScript | 2 | 3,017 (2,990–3,299) | 3,085 | 8 | 10 |
| TypeScript | 4 | 4,230 (3,977–4,297) | 3,480 | 7 | 10 |
| Java | 1 | 2,226 (2,144–2,289) | 3,129 | 7 | 9 |
| Java | 2 | 3,144 (3,130–3,329) | 3,411 | 8 | 11 |
| Java | 4 | 3,362 (3,256–3,931) | 3,309 | 7 | 11 |
The Crystal rows have no second instance: that worker does not use the gateway.
What it shows
- A job took 6 to 8 ms at the median and 8 to 16 ms at the 99th percentile from enqueue to completion through the gateway, whatever the language, the number of workers or the number of instances. A poll is answered when a job arrives. What is left of the median is mostly the 5 ms an SDK waits to batch outcomes, plus the enqueue call and the event stream.
- One worker process drained about 1,900 to 2,700 jobs per second, depending on the SDK. Four processes reached about 3,100 to 5,600. Past about 5,000 to 5,600 jobs per second in total, the server, Redis and the workers were out of CPU on this machine: that ceiling belongs to the 4 cores, not to the gateway.
- A second server instance changed little on one machine, because both instances shared the same 4 cores. A second instance is for more CPU on other machines and for availability. Leases and waits are claimed atomically in Redis, so instances do not step on each other.
- Enqueueing one job per call reached about 2,500 to 3,900 jobs per second from 8 threads, whatever the worker. Each call is one audited HTTP request.
enqueue_manystores up to 500 jobs in one call; this benchmark did not use it. - Direct Redis was 2.5 to 3 times faster per process than the gateway SDKs on the same machine (6,436 against 2,100 to 2,700 jobs per second for one process), as expected: the gateway adds an HTTP hop and a lease record per task. Its latency is higher here (41 and 91 ms), because the Crystal worker's own polling interval sets it.
What changed from the first measurement
The same benchmark was run before the gateway moved from a 50 ms polling timer to notification-woken long polls and batched acknowledgements and heartbeats. One worker process, one server instance:
| Worker | Drain jobs/s before | after | p50 ms before / after | p99 ms before / after |
|---|---|---|---|---|
| Python | 158 | 2,680 | 28 / 7 | 54 / 8 |
| Go | 1,952 | 2,656 | 27 / 7 | 53 / 9 |
| TypeScript | 1,611 | 1,898 | 28 / 7 | 53 / 13 |
| Java | 925 | 2,099 | 29 / 7 | 61 / 15 |
The Python worker gained the most, 17 times, because it no longer sleeps 50 ms when its slots are full. The Crystal worker was not affected (6,436 jobs per second before and after).
What was not measured
TLS, a load balancer, workers on other machines, a server instance on its own machine, real handlers (anything that does work), and workflows (one task per run plus a heartbeat per step). The gateway's own CPU came out of the same 4 cores as everything else, so its capacity on a dedicated machine is higher than shown, by an amount nobody measured.
Per-request cost of the API (historical)
An earlier, separate measurement counted the memory each API route allocates per request and the time it takes, in one process with no network. It was taken on the legacy API stack, before the Azu refactor, so it does not describe the current server. It is kept as the reference the refactor was judged against: compare runs of the same measurement, not absolute numbers.
Release build, Crystal 1.22.2, CRYSTAL_WORKERS=1, local Redis and PostgreSQL, one handler call per request with no socket. About 34 KB of every response with a body is the measurement harness itself; "net" is what the application adds above it.
| Route | Status | Bytes per request | Net of harness | µs per request |
|---|---|---|---|---|
Harness floor (a handler that prints {"ok":true}) | 200 | 34,307 | 0 | 16.7 |
GET /capabilities (public, no Redis) | 200 | 40,689 | 6,382 | 32.4 |
GET /openapi.json (public, large body) | 200 | 136,438 | 102,131 | 40.3 |
GET /queues (authenticated, Redis) | 200 | 42,644 | 8,337 | 646.4 |
GET /nope (authenticated, 404 answer) | 404 | 39,946 | 5,639 | 51.4 |
POST /session with {} (public, 422 answer) | 422 | 39,683 | 5,376 | 46.9 |
POST /queues/default/pause (operator write, audited) | 204 | 5,695 | below the floor | 242.0 |
- Bytes are stable, time is not. Two runs gave 40,688 and 40,689 bytes for
/capabilities, but 755 and 646 µs for/queues: Redis round trips on a shared machine. Judge memory by the bytes, and time only by large, repeated differences. GET /queuesis dominated by Redis calls (about five per queue), not by memory.GET /openapi.jsonis built once and cached; its 100 KB is the cached text copied into the response.- It does not cover the live stream,
/metricsor concurrent requests.
Using these numbers
Size from your own handlers. In practice throughput is the number of tasks your workers run at once divided by how long a task takes, and a real handler is slower than the gateway by far. See Scale workers for the controls and Capacity for what to size beside the server.