Skip to content

SYSTEM Cited by 1 source

Cloudflare Queues

Cloudflare Queues is Cloudflare's messaging primitive on the Developer Platform: producers write messages from Workers, a configured consumer Worker receives batches with tunable size and timeout, and the queue handles delivery + retry + dead-lettering. Documented at developers.cloudflare.com/queues.

Role

  • Decoupling — producer Workers don't block on the consumer.
  • Batching as throughput-amortisation — the max_batch_size × max_batch_timeout two-knob trigger lets a consumer Worker drain N messages per invocation and bulk-process them (canonical use: bulk-write to D1 / external DBs / external APIs).
  • Per-region partitioning — by convention, queues are named per-region (-weur, -eeur, -wnam, etc.) when the consumer's downstream is a regionally-sharded substrate (e.g. D1 with location hints).

Canonical config (from Browser Run, 2026-05-13)

{
    "queues": {
        "consumers": [
            {
                "queue": "production-core-containers-queue-weur",
                "max_batch_size": 100,
                "max_batch_timeout": 1,
                "max_retries": 1
            }
        ]
    }
}

The two batching knobs (max_batch_size: 100, max_batch_timeout: 1 second) are the load-bearing primitives for the patterns/queue-batching-amortizes-db-write-throughput pattern — the consumer drains either when 100 messages are buffered or when 1 second elapses, whichever fires first.

Seen in

  • sources/2026-05-13-cloudflare-browser-run-now-running-on-cloudflare-containers-its-fastercanonical wiki instance for Queues as a DB-write throughput multiplier. Browser Run runs ~thousands of containers per location, each updating its state every 5 seconds; without batching, the per-row D1 write rate caps the per-location ceiling at ~5,000 containers (1 ms / row × 1,000 writes/sec). Queues at max_batch_size: 100, max_batch_timeout: 1 makes each consumer drain a 100-row batch which D1 commits at P95 0.1 ms — the same wall-clock cost as a single-row write — lifting the per-location ceiling to 500,000 containers (a 100× headroom multiplier) at <2-second steady-state lag. Same post canonicalises a paired backup-region fallback for the case when a primary queue's lag exceeds the staleness budget — the queue's job is allocation-control-plane freshness, not data-plane carrying-over.
Last updated · 542 distilled / 1,571 read