Skip to content

Capacity ​

What to size beside the server: PostgreSQL connections, Redis, and the limits built into the server. The numbers at the end say what one instance did in our own measurements.

PostgreSQL connections ​

Each instance opens up to JOOBQUI_DB_POOL_SIZE connections, 20 by default.

text
instances × JOOBQUI_DB_POOL_SIZE  <  max_connections − what else uses the database
SettingDefaultWhat it does
JOOBQUI_DB_POOL_SIZE20 (2 to 500)The most connections one instance opens
JOOBQUI_DB_IDLE_POOL_SIZEthe pool size, at most 10How many it keeps open when idle
JOOBQUI_DB_CHECKOUT_TIMEOUT5.0 secondsHow long a request waits for a free connection

PostgreSQL holds accounts, tokens, settings and the audit log, not jobs: its load follows people and API calls, not queue throughput. Command-line tasks connect too; workers never do.

Redis ​

Redis holds every job, every workflow history and every lease, so it is the component to size with care.

RequirementWhy
Version 6.2 or newerThe queues and the SDK gateway use commands from it
One host or a unix socketSentinel and Cluster are not supported. A managed Redis with a single endpoint and its own failover works
Persistence on (AOF or snapshots)The server does not configure it. Without it a restart loses every queued job and workflow: see Recovery
maxmemory-policy noevictionWith an evicting policy Redis silently drops jobs and session revocations when it fills up
Memory for the backlog you expectJobs, dead letters and finished workflows stay until they are processed or retention removes them

Each instance opens up to REDIS_POOL_SIZE connections (200 in the image) plus a few for the live stream, and waits REDIS_POOL_TIMEOUT (2 seconds) for a free one. Workers open none. Keep the total under Redis's maxclients.

Dead letters and finished workflows are kept for ever by default. Set JOOBQUI_DLQ_RETENTION_DAYS and JOOBQUI_WORKFLOW_RETENTION_DAYS before memory becomes the problem.

Built-in limits ​

LimitValue
Queues listed by /metrics per scrape200 (joobqui_metrics_truncated turns 1 beyond that)
Jobs stored by one enqueue_many call500
Tasks a throttled queue hands out per poll1

Measured throughput ​

One machine with 4 cores running the server, Redis, PostgreSQL, the producers and the workers together, with handlers that do nothing. Treat them as orders of magnitude, not as promises. The full tables, the method and what was not measured are on Benchmarks.

WhatJobs per second
One worker process through one server instance1,900 to 2,700
Four worker processes through one server instanceabout 5,000 to 5,600, where the machine ran out of CPU
Enqueueing through the gateway, one job per call, 8 threads3,000 to 3,500

Through the gateway a job took 6 to 8 ms at the median from enqueue to completion, and 8 to 16 ms at the 99th percentile. Real handlers are slower than the gateway: in practice throughput is the number of tasks your workers run at once, divided by how long a task takes.

Check it worked ​

Watch these while you raise the load (Monitoring):

  • CPU of the server instances, and of Redis (which uses one core for commands).
  • joobqui_queue_size falling as fast as jobs arrive.
  • joobqui_api_requests_total{status_class="5xx"} staying flat. Errors that appear only under load usually mean a connection pool ran out: see Slow, or out of capacity.