Admin calls provision the lane on every call, serialising parallel DLQ drains; no bounded bulk retry
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 1/100
Direzione di ricerca
The issue says the fixes are in 0.6.19 and main, so first inspect the relevant code and tests for QueueStorage::ensure_lane, bounded DLQ retries, and the awa dlq retry-bulk CLI, then compare them with the described behavior. Done means cache misses check lane visibility before provisioning and bounded retries process at most the requested batch size, with the documented CLI, UI, and Python options.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Module-level admin calls run lane provisioning on every call, including for lanes that already exist. That serialises parallel DLQ drains on the lane's provisioning lock, and there is no bounded bulk retry to use instead. This body is the current state.
Observed
A deployment on 0.6.16/0.6.17 drained a large DLQ by calling dlq::retry_from_dlq once per job, about 766,000 calls over 12 days. Lane provisioning ran on every call and took about 90% of the database time those retries spent (pg_stat_statements for that role):
| Statement | Calls | Total | Mean | Max |
|---|---|---|---|---|
SELECT COALESCE(has_function_privilege(...)) FROM (SELECT pg_advisory_xact_lock(...)) AS lane_lock |
766,047 | 6,387 s | 8.3 ms | 1,378 ms |
SELECT {schema}.provision_lane($1, $2, $3) |
766,047 | 240 s | ||
SELECT {schema}.reserve_enqueue_seq(...) |
766,047 | 183 s | ||
INSERT INTO {schema}.ready_entries ... |
747,915 | 106 s | ||
DELETE FROM {schema}.dlq_entries WHERE job_id = $1 ... |
766,045 | 38 s |
Cause
Module-level admin functions build a new QueueStorage per call (active_queue_storage → QueueStorage::from_existing_schema). Its lane cache starts empty, so ensure_lane goes straight to ensure_lane_inserts, which runs five statements: the queue_lanes insert, the lane provisioning lock with a privilege probe, SAVEPOINT, provision_lane and RELEASE. A held store only checks that the lane's queue_enqueue_heads row is visible.
These paths pay the cost on every call:
dlq::retry_from_dlqanddlq::bulk_retry_from_dlqadmin::retry,bulk_retry,retry_failed_by_kind,retry_failed_by_queue,retry_external, andcancelof a deferred jobreschedule, once per job- batch set-priority and move-queue, once per job inside a batch
The lock is the lane's provisioning lock ({schema}:{queue}:{priority}:{shard}), not the in-lane enqueue ordering lock that reserve_enqueue_seq takes. Producers with a warm store never take it. The waits come from cache-missing calls queuing behind each other: each holds the provisioning lock while it waits behind producers for the ordering lock and then commits. A sequential drain shows a mean of 0.04–0.1 ms on the lane_lock statement. The 8.3 ms mean implies the drain ran in parallel.
Callers loop the single-job API because bulk_retry_from_dlq revives every matching row in one transaction and ignores ListDlqFilter::limit. The CLI (awa dlq retry-bulk) and the UI bulk-retry route have the same limitation.
Measured (0.6, PG 17)
200 single-job retries:
| Path | lane_lock calls |
provision_lane calls |
|---|---|---|
dlq::retry_from_dlq |
200 | 200 |
One held QueueStorage |
1 | 1 |
| Visibility check on a cache miss (fix 1) | 0 | 0 |
2,000 retries beside 4 producers enqueueing batches of 10:
| Build | Drain tasks | Retries/s | Producer jobs/s |
|---|---|---|---|
| Current | 1 | ~58 | ~2,380 |
| Current | 8 | ~57 | ~2,260 |
| Fix 1 | 1 | ~60 | ~2,400 |
| Fix 1 | 8 | ~220 | ~1,120 |
Fix 1 removes the provisioning cost, but the provisioning lock had been holding parallel drains to one at a time. Without it, parallel drains contend directly with producers on the ordering lock, and producer throughput halves with 8 drainers. Bounded batches (fix 2) are what make a large drain cheap.
Fix (0.6.19 and main)
- Check lane visibility on a cache miss.
ensure_laneruns thequeue_enqueue_headsvisibility check beforeensure_lane_inserts, and provisions only when the lane does not exist. Rust only, no schema change. In-lane commit order is unchanged: it comes fromreserve_enqueue_seq, which also re-provisions a missing sequence. - Bounded bulk retry. A new explicit batch function revives at most
nmatching DLQ rows in one transaction (oldest first,FOR UPDATE SKIP LOCKED) and returns the count. It is exposed as--batch-size(and an optional total--limit) onawa dlq retry-bulk, an optionallimiton the UI bulk-retry route, andlimit=Nonein Python. The existingbulk_retry_from_dlqkeeps its behaviour, so callers who pass a list filter with a limit are unaffected. A unique conflict aborts its batch, so the CLI loop stops and names the job instead of retrying it forever. - Docs. Long-running tooling should hold one
QueueStorageand call its methods.
Workaround before 0.6.19
Hold one QueueStorage and call store.retry_from_dlq in a loop, one lane at a time. That runs provisioning once per lane, and a sequential drain is no slower than a parallel one on current releases.
- Lingua principale
- Rust
- Stelle
- 37
- Fork
- 8
- Merge medio
- 14h 16m
- PR unite (30g)
- 244
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hardbyte/awa
-
feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
0.6.19 release checklistApertaoperational
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
hardbyte/awa#861 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
hardbyte/awa#841 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di hardbyte/awa
Issue simili
-
Mobile release verification reports missing build inputs with a custom Cargo target directoryApertabug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsotto/sotto-authenticator#139 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
registrystack/registry-stack#2924 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
foundry-rs/starknet-foundry#4733 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100