Check your object store
Buffered items are stored under thebuffer/ prefix of a bucket in your object store, the same store that holds large payloads. The bucket is the one configured for BUFFERED_TASKS_OBJECT_STORE_PROTOCOL (or OBJECT_STORE_DEFAULT_PROTOCOL when it’s unset), falling back to OBJECT_STORE_BUCKET, then packets.
The store must support conditional writes: If-None-Match: * and If-Match on PutObject.
For any other S3-compatible store, run this check with the AWS CLI (2.27 has the
--if-none-match option used here), using the webapp’s credentials:
An error occurred (PreconditionFailed) when calling the PutObject operation. If step 2 succeeds, or step 1 fails with anything but an access error (MinIO 2023 answers NoSuchKey), the store doesn’t support them.
The webapp runs a fuller version of this check at startup. When the store refuses conditional writes, buffered triggers answer 501, the webapp logs Buffered tasks are disabled: the object store lacks conditional writes, and it checks again every minute, so upgrading the store needs no restart. When the store can’t be reached, buffered triggers answer 503 and it checks again after 10 seconds. Everything else keeps working either way.
Bucket permissions
The webapp’s credentials need these on thebuffer/ prefix:
s3:PutObject,s3:GetObjectands3:DeleteObjecton<bucket>/buffer/*s3:ListBucketon<bucket>, for keys starting withbuffer/
503 on buffered triggers and Buffer object store check failed; retrying later in the log, not as a 501.
What the object store holds
Each item is in the object store from the moment its trigger gets a202 until its window’s run exists. After that, the items are the run’s payload, stored like any other payload.
- Durability. A
202is sent only after the item is written. Accepted items are as durable as your object store. - Cleanup. The webapp deletes objects under
buffer/once it no longer needs them, about once a minute. Don’t delete objects there yourself or add an expiry rule to the prefix: open windows and the shard layout live there. - Size. The prefix holds items that haven’t run yet plus small bookkeeping objects. With windows running on time it stays small: a 30 minute test at 400 items a second kept object counts flat and every snapshot under 1MB.
- Requests. Each process that stores items writes one object per batch, about 20 writes a second whatever the item rate (
BUFFERED_TASKS_INGEST_INTERVAL_MS, default 50ms). Raise the interval to make fewer requests, at the cost of that much latency on every buffered trigger.
Add consumer processes
One webapp process does everything by default (BUFFERED_TASKS_ROLE=all) with 1 shard. To spread the work of closing windows, run more processes from the same image with BUFFERED_TASKS_ROLE=consumer, and set the same BUFFERED_TASKS_SHARD_COUNT on the webapp and every consumer. Consumers share the shards and rebalance when one joins or leaves.
A consumer needs the webapp’s environment (database, Redis, object store, ENCRYPTION_KEY). It serves only /healthcheck, doesn’t run the run engine’s workers or replication, and needs no published port.
With Docker Compose, add a service to hosting/docker/webapp/docker-compose.yml that extends the webapp, and set the shard count on both:
hosting/docker/webapp/docker-compose.yml
!reset needs Docker Compose 2.24 or later.
The Helm chart has no values for consumer processes. Set BUFFERED_TASKS_SHARD_COUNT in webapp.extraEnvVars, and run consumers as your own Deployment with the webapp’s image, environment and BUFFERED_TASKS_ROLE=consumer.
Shard count rules:
- 1 to 256 shards. The count can only grow: to a multiple of the current count, at most 4 times it per change, and at least 10 minutes after the last change. A refused change logs
Buffer consumer keeps the prefix's shard countand keeps the old count. - Use at least as many shards as you’ll ever want consumers, since each shard has one owner at a time.
Separate ingest processes
At higher rates you can also split accepting items from storing them:api processes take buffered triggers and forward them to ingest processes, which write them to the object store. Set BUFFERED_TASKS_INGEST_ORIGIN on api processes and the same BUFFERED_TASKS_INGEST_SECRET on both roles. You can run several ingest processes behind one address; each registers itself in the object store and consumers read from all of them.
Most self-hosted instances don’t need this: one process stores a few thousand items a second.
Sizing
Measured on our test hosts:
The cost of storing items is per request, not per item: send items in batches where you can. Window runs also count against your run engine’s capacity like any other run.
When something fails
Useful log lines to alert on:
Buffer ingest write failed, callers get a 503, Buffer shard lease lost, Buffer window trigger failed, will retry, Buffer consumer tick failed and Buffered tasks are disabled. The webapp also exports OpenTelemetry metrics under buffered_tasks.*, such as buffered_tasks.held.items, buffered_tasks.consumer.lag and buffered_tasks.window.overdue.
Turn it off or roll back
SetBUFFERED_TASKS_ENABLED=0, or turn off the bufferedTasks flag for one organization on the admin dashboard. New buffered triggers then answer 403 with Buffered tasks aren't enabled for this organization yet.
Items that were already accepted still run: consumers don’t check the flag, so open windows close and run as usual. Keep the consumer processes running until they have.
If you go back to a webapp version without buffered tasks, the items it accepted stay in the object store and their windows don’t run until a version with buffered tasks runs again.
