Metrics refresh full-scans okapi_outbox (COUNT(*) GROUP BY status incl. 7 days of DELIVERED) every 15s per instance
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 42/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- kotlin, mysql, postgresql
調査の方向性
Start in MicrometerOutboxMetrics, where the refresh runs the two queries, and in OutboxStore.countByStatuses and findOldestCreatedAt, which hold the GROUP BY status SQL. Decide which statuses the metrics need, then rewrite the oldest-per-status lookup as an index-ordered LIMIT 1 query per status. Done when the queries no longer scan DELIVERED rows and the metrics tests still pass on both PostgreSQL and MySQL.
索引モデルが issue の本文から書いたものです。
説明
Severity: Medium (performance) · Area: okapi-micrometer MicrometerOutboxMetrics, OutboxStore.countByStatuses/findOldestCreatedAt · Found in: code review of main @ e5630a1
Problem
Every metrics refresh runs two queries per instance, every 15 s by default:
SELECT status, COUNT(*) FROM okapi_outbox GROUP BY status;
SELECT status, MIN(created_at) FROM okapi_outbox WHERE status IN (?,?,?) GROUP BY status;
COUNT(*) ... GROUP BY statushas to visit every row. The table keeps 7 days ofDELIVEREDrows by default (purger retention), which is ~60 M rows at 100 msg/s. N application instances each run this full scan every 15 s.- The
MIN(created_at)query is index-friendly on MySQL (loose index scan), but Postgres before v18 has no skip scan.GROUP BY statuswithINcan scan the whole(status, created_at)index, again dominated byDELIVEREDrows nobody alerts on.
Load grows with retention × throughput × instance count, on the same primary that serves the application's writes.
Suggested fix
- Restrict both queries to the statuses that matter operationally (
PENDING,FAILED).DELIVEREDcount/lag is rarely useful, and when it is, it can come from the counters. - Compute oldest-per-status with per-status index-ordered lookups, e.g.
(SELECT created_at FROM okapi_outbox WHERE status='PENDING' ORDER BY created_at LIMIT 1), which costs O(log n) on both databases. - Optionally report
DELIVEREDfrom planner estimates or drop it.
- 主要言語
- Kotlin
- スター
- 14
- フォーク
- 0
- 平均マージ
- 9時間 54分
- マージ済み PR(30日)
- 11
環境構築
このプロジェクトには開発コンテナ、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 が今日担当しました。 オープンbreaking-change bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
softwaremill/okapi#137 ·
メンテナーはふだん 1 日以内に返信
-
breaking-change bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
softwaremill/okapi#135 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 半日 初心者へのやさしさ 62/100
softwaremill/okapi#134 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
softwaremill/okapi#133 ·
メンテナーはふだん 1 日以内に返信
softwaremill/okapi の issue をすべて見る
似ている issue
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
airbytehq/airbyte#91201 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Source: c7 Type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
2.23
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
ankidroid/Anki-Android#23042 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
[Submission] AI通话助手オープンsubmit-adaption submit-adaption-pre
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
BetterAndroid/android-notification-icon-project#828 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信