Skip to content

Active-segment point reads serialize on one Mutex<FdCache> #217

Description

@heyoub

Version: 0.10.0. core/src/store/segment/scan/point_read.rs:285with_fd holds self.fd_cache.lock() across the whole pread; buffer_pool is likewise a single Mutex<Vec<..>> (scan/mod.rs:74-76).

Asymmetry: sealed segments read through sealed_maps: DashMap<u64, Mmap> — genuinely concurrent, zero-copy (INV-MMAP-SEALED-READS). Any read that touches the active tail queues on one process-wide mutex.

Observed downstream: a consumer issuing ~230k read_raw calls during a projection fold showed heavy futex traffic attributable to this lock (strace: 105k futex calls, 10.6k contended, on a single-threaded workload interleaving with the store's own threads). For consumers fanning out reads across worker threads, the active-segment tail becomes the concurrency ceiling regardless of core count.

Ask (neutral, either shape): (a) shard the fd cache (per-thread or N-way keyed by segment), or (b) document the sealed-vs-active read-concurrency contract explicitly so consumers can design fan-outs around it (e.g. "reads behind the seal are parallel; tail reads serialize"). No preference; measurements available.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions