Reduce load_job round trips and keep its SQL stable

Aperta
#679 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
36/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, rust

Direzione di ricerca

Start by locating QueueStorage::load_job and the list_jobs path that calls it per row. Measure latency and round trips at a realistic job count, then inspect how the snapshot and savepoint legs build SQL for configured ready slots. Done means the reads are batched for list_jobs, generated SQL stays stable per slot count, and snapshot guarantees hold while round trips are reduced.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

QueueStorage::load_job now reads from one REPEATABLE READ snapshot across several legs, each wrapped in a savepoint so that leg's relation locks can be released. That is about 15 statements and 7 savepoint pairs, roughly 24 round trips on one held connection. In 0.6.13 it was 7 autocommit statements.

Where it runs

  • Admin job details.
  • Admin list_jobs, once per row on a page.
  • Worker completion and callback paths, whenever lifecycle handlers are registered.

Problems

  • The SQL text varies with the set of populated ready slots (a dynamic UNION ALL of child tables), which can churn sqlx's prepared-statement cache.
  • The compact claim-batch leg scans every claim batch (unnest(job_ids) filtered on items.job_id). Under load this picks parallel plans; a soak run hit thousands of could not resize shared memory segment errors from it. The indexed lookup for this leg is being done separately for 0.6.15.

Proposal

  • Measure load_job latency and round trips at a realistic job count.
  • Collapse legs where the snapshot guarantee allows.
  • Keep the generated SQL stable per configured slot count.
  • Batch the per-row reads behind list_jobs into one multi-job read.
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hardbyte/awa

Tutte le issue di hardbyte/awa

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.