Skip to content

Disk polling: investigate repeated batch verification and record scanning #4176

Description

@diegomrsantos

Part of #4174, which records the shared benchmark setup, revisions and evaluation criteria.

walk_disk_chunk decodes a complete batch and verifies checksums when enabled. select_batch_slice then walks records to locate the requested slice. Adjacent small polls can revisit the same batch, and selecting a late record can scan preceding records.

Historical profiles measured substantial CPU time in the inclusive checksum and hash category:

Workload Baseline sampled CPU, µs per poll Candidate sampled CPU, µs per poll
Explicit offset, without concurrent writes 100.474 101.810
Explicit offset, with concurrent writes 109.583 110.524

The category includes called functions and overlaps its callers, so it cannot be added to their CPU totals. These samples establish neither repeated verification nor avoidable work. The shared sampling method and workload limits are in #4174.

verify_and_recompute_batch_checksum already validates message bodies and recomputes the batch checksum in one frame walk. Investigate repeated visits and selection costs before assuming a duplicate pass exists.

  1. Count bytes hashed, records visited, distinct batches and repeat visits per returned message. Attribute current hash samples to callers and distinguish verification from record selection.
  2. Vary batch size, requested message count and position within a batch. Determine whether the cost comes from large batches, repeated visits, locating a late record or the hash implementation.
  3. Share counters with Disk polling: investigate excess read bytes for small responses #4175, then test one verification or parsing change separately from read sizing. Confirm any component saving through polling, including larger requests and concurrent writes.

Preserve configured checksum and body validation, malformed frame rejection and the parent's output guarantees. A previously verified file range does not establish the integrity of newly read bytes: corruption and path reuse can occur later. Any retained verified buffer needs bounded memory, correct identity and explicit invalidation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceChange impacts performanceserveriggy-server related change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions