Cancelling jobs by ID on queue storage costs ~9 ms a job, mostly re-planning
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 53/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- postgresql, rust
- 領域
- databases, performance
調査の方向性
Start by reading cancel_job_tx and lock_claim_heads_of_jobs_tx, then inspect the ready-row lookup and ready-reference statements described in the issue. Compare set-based cancellation with force_generic_plan using pg_stat_statements on 20k and 200k lanes. Done means lower per-job cancellation cost with measured claim-ring prune outcomes during a large cancel.
索引モデルが issue の本文から書いたものです。
説明
Cancelling jobs by ID on queue storage costs about 9 ms a job, so cancelling a large lane takes long transactions and holds ring partitions and claim heads for seconds per chunk. This body is the current state.
Observed
- Soak on 839120ce: cancelling a 200,000-job lane through
admin::bulk_cancelin 1,000-ID calls took 1,550 s (about 7.7 s per call). The claim ring stopped advancing for 495 s, with 65 claim-ring prunesblocked. - Measured with
pg_stat_statements(track_planning = on) on PostgreSQL 18, release build, 250-job chunks:- about 9 ms a job wall time, the same at the head, middle and tail of the lane and on a 20,000-job lane, so it is not a lane-wide scan;
- about 15 statements a job, executing in about 1.6 ms in total;
- about 5.4 ms a job of planning: the ready-row lookup in
cancel_job_tx(WITH target AS (SELECT ready.* FROM ready_entries JOIN queue_claim_heads ...)) is re-planned on almost every call at about 5.4 ms a plan, the ready-reference statement (WITH refs ... unnest) at about 1 ms, andlock_claim_heads_of_jobs_txat about 0.85 ms. They read the partitioned ring tables, and PostgreSQL keeps choosing custom plans; - the rest is per-statement round trips.
- #799's lane-visibility change does not affect it.
#801 shrinks queue-storage cancel-by-ID chunks to 250 IDs with a 100 ms pause between them, which bounds each transaction to about 2.2 s but leaves the per-job cost.
Proposal (0.6.x and main)
- Cancel a chunk with set-based statements: look up the chunk's ready rows, claim heads and references once per chunk instead of once per job.
- Or, as a smaller step, run the cancel transaction with
SET LOCAL plan_cache_mode = force_generic_planand measure the plans it gets. - Measure before and after on 20k and 200k lanes, including claim-ring prune outcomes during a large cancel.
Rust only; no schema change. Related: #798, #799, #801, #721.
- 主要言語
- Rust
- スター
- 37
- フォーク
- 8
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 244
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hardbyte/awa のほかの issue
-
feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
operational
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsotto/sotto-authenticator#139 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
registrystack/registry-stack#2924 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
foundry-rs/starknet-foundry#4733 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100