Metrics refresh full-scans okapi_outbox (COUNT(*) GROUP BY status incl. 7 days of DELIVERED) every 15s per instance
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 42/100
- Issue-Typ
- Refactoring
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- kotlin, mysql, postgresql
- Bereich
- databases, observability
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Kotlin
- Sterne
- 14
- Forks
- 0
- Ø Merge
- 9 Std. 54 Min.
- Gemergte PRs (30 T.)
- 11
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus softwaremill/okapi
-
bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
softwaremill/okapi#141 ·
Maintainer antworten meist innerhalb von 1 Tag
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failureEvtl. vergeben @rawo hat das heute übernommen. Offenbreaking-change bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
softwaremill/okapi#137 ·
Maintainer antworten meist innerhalb von 1 Tag
-
breaking-change bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
softwaremill/okapi#135 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 62/100
softwaremill/okapi#134 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 22/100
softwaremill/okapi#133 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in softwaremill/okapi
Ähnliche Issues
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
airbytehq/airbyte#91201 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug javascript
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Source: c7 Type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
2.23
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
ankidroid/Anki-Android#23042 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Submission] AI通话助手Offensubmit-adaption submit-adaption-pre
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
BetterAndroid/android-notification-icon-project#828 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag