Skip to content

Bring back medida::Timer now that CKMS compression is much faster - #5412

Merged
marta-lokhova merged 1 commit into
stellar:masterfrom
marta-lokhova:txLatencyPercentiles
Aug 12, 2026
Merged

marta-lokhova merged 1 commit into
stellar:masterfrom
marta-lokhova:txLatencyPercentiles

Conversation

@marta-lokhova

Copy link
Copy Markdown
Contributor

Resolves #5353

Copilot AI balanced review requested due to automatic review settings August 11, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores percentile-bearing medida timers for transaction latency metrics after CKMS optimizations.

Changes:

  • Replaces transaction queue and overlay SimpleTimer metrics with medida::Timer.
  • Updates load generation and overlay tests for the restored metrics.
  • Updates metric documentation and comments.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/metrics.md Documents restored timer metrics.
src/herder/TransactionQueue.cpp Registers queue latency timers.
src/herder/TransactionQueue.h Changes queue metric types.
src/ledger/LedgerManagerImpl.cpp Updates timer commentary.
src/overlay/OverlayMetrics.cpp Restores the receive-transaction timer.
src/overlay/OverlayMetrics.h Changes the cached metric type.
src/overlay/test/OverlayTests.cpp Updates metric references in tests.
src/simulation/LoadGenerator.cpp Reads applied counts from timers.
Suppressed comments (1)

src/herder/TransactionQueue.cpp:1117

  • This independently restores per-transaction CKMS work for the Soroban queue without performance evidence for this workload. The linked medida result relies on batching in the apply path, whereas this queue still records each sample individually; please provide a representative Soroban throughput comparison or use UpdateMany before enabling these timers, as required by CONTRIBUTING.md:56-60.
        app.getMetrics().NewTimer({"herder", "pending-soroban-txs", "delay"}),
        app.getMetrics().NewTimer(
            {"herder", "pending-soroban-txs", "self-delay"}),

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/overlay/OverlayMetrics.cpp Resolved
Comment thread src/herder/TransactionQueue.cpp Resolved
@marta-lokhova

Copy link
Copy Markdown
Contributor Author

Perf of the change looks good. Some AI-assisted benchmarks:

### 1,000,000 inserts

| Distribution              | Old total (ms) | New total (ms) | Speedup | Old worst insert | New worst insert |
|---------------------------|---------------:|---------------:|--------:|-----------------:|-----------------:|
| uniform                   |           7720 |            292 |   26.4x |           7.9 ms |          0.20 ms |
| uniform + periodic get()  |           7718 |            318 |   24.3x |           7.8 ms |          0.19 ms |
| lognormal (latency-like)  |           7661 |            292 |   26.2x |           7.3 ms |          0.19 ms |
| lognormal + periodic get()|           7718 |            319 |   24.2x |           8.8 ms |          0.19 ms |
| sorted ascending          |            397 |            225 |    1.8x |           0.26 ms|          0.14 ms |
| heavy duplicates          |          11113 |            477 |   23.3x |          18.0 ms |          0.39 ms |

### 100,000 inserts

| Distribution              | Old total (ms) | New total (ms) | Speedup | Old worst insert | New worst insert |
|---------------------------|---------------:|---------------:|--------:|-----------------:|-----------------:|
| uniform                   |          209.2 |           14.7 |   14.3x |           1.8 ms |          0.08 ms |
| uniform + periodic get()  |          210.1 |           15.5 |   13.6x |           1.8 ms |          0.07 ms |
| lognormal (latency-like)  |          210.6 |           14.7 |   14.3x |           1.7 ms |          0.08 ms |
| lognormal + periodic get()|          211.3 |           15.6 |   13.6x |           1.8 ms |          0.08 ms |
| sorted ascending          |           28.3 |           10.5 |    2.7x |           0.19 ms|          0.06 ms |
| heavy duplicates          |          325.1 |           15.7 |   20.8x |           5.3 ms |          0.10 ms |

More importantly, Max TPS test passed 1650 mark in the most recent run, and v28.0.0 finished at 1692, so medida Timer is now just as performant.

@marta-lokhova
marta-lokhova added this pull request to the merge queue Aug 12, 2026
Merged via the queue into stellar:master with commit 976ae48 Aug 12, 2026
70 checks passed
@marta-lokhova
marta-lokhova deleted the txLatencyPercentiles branch August 12, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider supporting percentiles with medida timer in transaction e2e metric

3 participants