Scheduler processes one batch per worker per tick: default throughput capped at <10 msg/s, backlog grows unbounded
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in the OutboxScheduler in okapi-core, where scheduleWithFixedDelay runs processNext(batchSize) once per worker per tick, and read processBatch to see how each tick's transaction is opened. Change it so the loop keeps draining while a batch comes back full, with one transaction per iteration and a time or iteration budget that still lets stop() return promptly. Done means a sustained high publish rate no longer backs up the queue under default settings, stop() stays responsive, and the existing tests pass; the issue also asks for a benchmark of sustained throughput.
索引モデルが issue の本文から書いたものです。
説明
Severity: High (performance / unbounded backlog) · Area: okapi-core OutboxScheduler · Found in: code review of main @ e5630a1
Problem
Each scheduler tick has every worker call processNext(batchSize) exactly once, using scheduleWithFixedDelay. That puts a hard ceiling on throughput:
max throughput ≈ concurrency × batchSize / (interval + batch processing time)
With the defaults (concurrency = 1, batchSize = 10, interval = 1s) that is under 10 messages/second, regardless of how fast the DB and transport are. Any sustained publish rate above that grows the backlog without bound, and latency grows linearly with it. A burst of 100k messages takes about 3 hours to drain with the defaults, even when each batch takes milliseconds.
Raising interval to cut idle polling makes this worse. Raising batchSize makes transactions longer (see the related issues on gap locks and delivery inside the transaction).
Suggested fix
In processBatch, keep draining while the previous batch was full. Each iteration gets its own transaction, and the loop is bounded by a time or iteration budget so stop() stays responsive:
do {
val n = transactionRunner.runInTransaction { outboxProcessor.processNext(config.batchSize) }
} while (n == config.batchSize && running.get() && !budgetExceeded())
That way the poll interval only governs idle latency, not peak throughput. The benchmarks should cover a sustained-rate scenario as well as fixed-backlog drains.
- 主要言語
- Kotlin
- スター
- 14
- フォーク
- 0
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
softwaremill/okapi のほかの issue
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
softwaremill/okapi#141 ·
メンテナーはふだん 1 日以内に返信
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failure対応中かも @rawo が 2 日前に担当しました。 オープンbreaking-change bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
softwaremill/okapi#137 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 1〜2日 初心者へのやさしさ 42/100
softwaremill/okapi#136 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 半日 初心者へのやさしさ 62/100
softwaremill/okapi#134 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
softwaremill/okapi#133 ·
メンテナーはふだん 1 日以内に返信
softwaremill/okapi の issue をすべて見る
似ている issue
-
[Submission] 招商银行オープンsubmit-adaption submit-adaption-pre
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
BetterAndroid/android-notification-icon-project#848 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
"Tick" is confusingオープンbug
難易度 1/5 1〜3時間 初心者へのやさしさ 70/100
orgzly-revived/orgzly-android-revived#1132 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
commons-app/apps-android-commons#7275 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
liberation-data/drivine4j#682 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
developmentwithyash/yaan#14 ·
メンテナーはふだん 2 日以内に返信