Skip to content

feat(inkless:consume): add diskless reader throughput metrics - #727

Merged
giuseppelillo merged 1 commit into
mainfrom
jeqo/kc-275-reader-throughput-metrics
Jul 29, 2026
Merged

feat(inkless:consume): add diskless reader throughput metrics#727
giuseppelillo merged 1 commit into
mainfrom
jeqo/kc-275-reader-throughput-metrics

Conversation

@jeqo

@jeqo jeqo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Adds byte-level throughput metrics for the diskless fetch path:

  • DisklessBytesOutPerSec, CacheHitBytesPerSec, StorageBytesInPerSec, StorageLaggingBytesInPerSec on InklessFetchMetrics (per-Reader JMX group), recorded at the FetchPlanner cache/storage read sites.
  • ConsolidationSupplementRate, ConsolidationSupplementBytesPerSec, ConsolidationLocalBytesPerSec on ReplicaManager, recorded across the synchronous fetchMessages path and DelayedFetch.

The three consolidation meters are recorded only on the paths that respond from the synchronous local-log read; the delayedResponse path discards that read and re-reads (and re-issues the supplement) inside DelayedFetch, which records there, so marking in both would double-count.

CacheHitBytesPerSec is attributed from the future's completion state at lookup (a true hit returns an already-complete future), so a caller that coalesces onto an in-flight cache miss is not miscounted as a cache hit.

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

This PR adds byte-throughput meters for Inkless diskless fetches (per-reader) and for the “consolidation supplement” paths in the broker, so operators can observe consumer-served bytes, cache-hit bytes, and remote-storage download rates for both hot and lagging consumer paths.

Changes:

  • Add new per-reader diskless throughput meters to InklessFetchMetrics and record them inside FetchPlanner hot/cold fetch paths.
  • Add consolidation supplement/local byte meters on ReplicaManager, recording in both synchronous fetch handling and DelayedFetch (without double-counting).
  • Update metrics documentation and add/extend unit tests to validate the new meters’ behavior.

Reviewed changes

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

Show a summary per file
File Description
storage/inkless/src/test/java/io/aiven/inkless/consume/FetchPlannerTest.java Adds assertions verifying the new diskless throughput metric recording on cache hit/miss and lagging paths.
storage/inkless/src/main/java/io/aiven/inkless/consume/InklessFetchMetrics.java Defines/registers/removes new meters and exposes new record*Bytes* methods.
storage/inkless/src/main/java/io/aiven/inkless/consume/FetchPlanner.java Records new throughput meters at cache/storage read sites for hot and lagging fetch paths.
docs/inkless/metrics.rst Documents the newly added per-reader throughput metrics.
core/src/test/scala/unit/kafka/server/ReplicaManagerInklessTest.scala Adds tests validating consolidation metric recording and non-double-counting across sync vs delayed fetch.
core/src/main/scala/kafka/server/ReplicaManager.scala Introduces consolidation supplement/local byte meters and records them on synchronous response paths only.
core/src/main/scala/kafka/server/DelayedFetch.scala Records consolidation local bytes and supplement meters during the delayed-fetch re-read/re-supplement path.
Comments suppressed due to low confidence (2)

core/src/test/scala/unit/kafka/server/ReplicaManagerInklessTest.scala:2492

  • This test asserts the Yammer meter is exactly 0, but Yammer meters are registered in a global registry and can have non-zero counts from earlier tests in the same JVM. Capture the baseline before calling fetchMessages and assert that it does not change while the request is parked.
      assertEquals(1, fetchPurgatory.watched(), "Fetch must park (supplement error, minBytes unmet)")
      assertEquals(0L, yammerMeterCount("ConsolidationLocalBytesPerSec"),
        "Sync read must not record local bytes when parking; DelayedFetch records them on completion")

core/src/test/scala/unit/kafka/server/ReplicaManagerInklessTest.scala:2545

  • This assertion expects the Yammer meter count to equal localBytes, but Yammer meters live in a global registry and may already have a non-zero count from previous tests. Capture the baseline before the fetch and assert on the delta instead.
      waitForFetchResponse(responseData)
      assertEquals(localBytes, yammerMeterCount("ConsolidationLocalBytesPerSec"),
        "Immediate response must record the local-log bytes exactly once")

@jeqo
jeqo force-pushed the jeqo/kc-275-reader-throughput-metrics branch from 943e8f4 to edd135c Compare July 29, 2026 08:22
@jeqo
jeqo requested a review from Copilot July 29, 2026 08:26

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

storage/inkless/src/main/java/io/aiven/inkless/consume/FetchPlanner.java:336

  • In the cold-path fetch, DisklessBytesOut/StorageLaggingBytesIn are recorded inside the primary supplier. If a hedge completes primary successfully and the primary supplier later fails (throws), the request is still served from the hedge but these throughput metrics will never be recorded because the supplier exits before the record* calls run. Consider recording these metrics from the future completion (the value that actually wins/completes primary), similar to the hot-path primary.thenAccept(...), and removing the in-supplier recording to avoid double-counting.
                        final FileExtent fileExtent = fetchFileExtent(laggingObjectFetcher, request, firstByteReceived);
                        metrics.recordStorageLaggingBytesIn(fileExtent.data().length);
                        metrics.recordDisklessBytesOut(fileExtent.data().length);
                        return fileExtent;

docs/inkless/metrics.rst:148

  • This doc update covers the new InklessFetch throughput meters, but the PR also introduces new broker-side consolidation throughput meters on ReplicaManager (ConsolidationSupplementRate/ConsolidationSupplementBytesPerSec/ConsolidationLocalBytesPerSec). Those new JMX metrics are not documented anywhere in this generated metrics reference; please add documentation for them (either by extending the generator or adding a dedicated section for these Yammer metrics) so operators can discover and interpret them.
RecentDataRequestRate                Rate of requests served via the hot path (recent data with cache) per second. Under the consolidation metrics group (ConsolidationFetchMetrics) this counts cache-hit peeks that reuse consumer-cached data.                                                                            
StorageBytesInPerSec                 Bytes downloaded from remote storage on the hot path (cache misses) per second. Counts the primary (cache-populating) download only; a hedged retry's second download is not counted here.                                                                                              
StorageLaggingBytesInPerSec          Bytes downloaded from remote storage on the cold path (lagging consumers) per second                                                                                                                                                                                                    

@jeqo
jeqo marked this pull request as ready for review July 29, 2026 08:49
@jeqo
jeqo force-pushed the jeqo/kc-275-reader-throughput-metrics branch from edd135c to 5d13dcf Compare July 29, 2026 13:50
Adds byte-level throughput metrics for the diskless fetch path:
- DisklessBytesOutPerSec, CacheHitBytesPerSec, StorageBytesInPerSec,
  StorageLaggingBytesInPerSec on InklessFetchMetrics (per-Reader JMX group),
  recorded at the FetchPlanner cache/storage read sites.
- ConsolidationSupplementRate, ConsolidationSupplementBytesPerSec,
  ConsolidationLocalBytesPerSec on ReplicaManager, recorded across the
  synchronous fetchMessages path and DelayedFetch.

The three consolidation meters are recorded only on the paths that respond
from the synchronous local-log read; the delayedResponse path discards that
read and re-reads (and re-issues the supplement) inside DelayedFetch, which
records there, so marking in both would double-count.

CacheHitBytesPerSec is attributed from the future's completion state at
lookup (a true hit returns an already-complete future), so a caller that
coalesces onto an in-flight cache miss is not miscounted as a cache hit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jeqo
jeqo force-pushed the jeqo/kc-275-reader-throughput-metrics branch from 5d13dcf to b726b4b Compare July 29, 2026 14:14
@giuseppelillo
giuseppelillo merged commit 5f20485 into main Jul 29, 2026
4 checks passed
@giuseppelillo
giuseppelillo deleted the jeqo/kc-275-reader-throughput-metrics branch July 29, 2026 14:44
giuseppelillo pushed a commit that referenced this pull request Jul 29, 2026
Adds byte-level throughput metrics for the diskless fetch path:
- DisklessBytesOutPerSec, CacheHitBytesPerSec, StorageBytesInPerSec,
  StorageLaggingBytesInPerSec on InklessFetchMetrics (per-Reader JMX group),
  recorded at the FetchPlanner cache/storage read sites.
- ConsolidationSupplementRate, ConsolidationSupplementBytesPerSec,
  ConsolidationLocalBytesPerSec on ReplicaManager, recorded across the
  synchronous fetchMessages path and DelayedFetch.

The three consolidation meters are recorded only on the paths that respond
from the synchronous local-log read; the delayedResponse path discards that
read and re-reads (and re-issues the supplement) inside DelayedFetch, which
records there, so marking in both would double-count.

CacheHitBytesPerSec is attributed from the future's completion state at
lookup (a true hit returns an already-complete future), so a caller that
coalesces onto an in-flight cache miss is not miscounted as a cache hit.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
giuseppelillo pushed a commit that referenced this pull request Jul 30, 2026
Adds byte-level throughput metrics for the diskless fetch path:
- DisklessBytesOutPerSec, CacheHitBytesPerSec, StorageBytesInPerSec,
  StorageLaggingBytesInPerSec on InklessFetchMetrics (per-Reader JMX group),
  recorded at the FetchPlanner cache/storage read sites.
- ConsolidationSupplementRate, ConsolidationSupplementBytesPerSec,
  ConsolidationLocalBytesPerSec on ReplicaManager, recorded across the
  synchronous fetchMessages path and DelayedFetch.

The three consolidation meters are recorded only on the paths that respond
from the synchronous local-log read; the delayedResponse path discards that
read and re-reads (and re-issues the supplement) inside DelayedFetch, which
records there, so marking in both would double-count.

CacheHitBytesPerSec is attributed from the future's completion state at
lookup (a true hit returns an already-complete future), so a caller that
coalesces onto an in-flight cache miss is not miscounted as a cache hit.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

3 participants