Skip to content

An abandoned parallel-read fan-out transfers most of the body seekable framing exists to avoid #514

Closed

Description

@scttfrdmn

Seekable framing (#185) makes a ranged read of a compressed object cost the index plus the frames covering the range. That holds for reads below parallel_read_threshold. Above it, the fan-out runs first, discovers the object is encoded from a chunk response, and abandons — but the chunks it already launched have transferred their bytes by then, and those bytes are the ones framing was going to avoid.

Measured

TestFanOutOnACompressedObjectFallsBackAndStaysCorrect logs it. 8 MiB object, ~50% compressible, 4,293,520-byte stored body, 2 MiB read, 1 MiB chunks, concurrency 4:

read offset bytes transferred share of stored body
0 (inside the stored body) 4,221,321 98%
6 MiB (past the end of it) 1,075,247 25%

The second row is what framing should cost — the chunks all 416 there, so they are free, and the read is index + frames. The first row is the whole body, which is what the read cost before framing existed. The framed read still runs and is still cheap; it just runs after the waste.

The waste is bounded by parallel_read_concurrency * read_chunk_size, not by the object, so it does not grow without limit. But those are the defaults on the path where framing matters most — a large read of a large compressed object — so for that case the feature currently buys close to nothing.

Why it is written this way

Deliberate, and correct when it was decided. #228 chose attempt-then-fall-back over HEAD-first so the cost of establishing whether an object is encoded lands on compressed objects instead of on every large read. At the time a compressed object was already paying a whole-body fetch, so the abandoned chunks were genuinely free. Framing changed that premise: the whole-body fetch is gone, and the chunks are now the entire cost. TestFanOutOnAnUncompressedObjectCostsNoExtraHead is what pins the choice, and it is the test any fix has to keep green.

Options

  1. HEAD before the fan-out when compression is configured. Simple, and Parallel range reads are disabled bucket-wide when compression is merely configured #228 rejected it — but it rejected it as a behaviour change keyed on config, and a HEAD is a cost, not a behaviour change. Still taxes every large read on a compression-enabled mount, including the uncompressed majority, which is what the existing test forbids.
  2. Launch chunk 0, wait only for its headers, then fan out the rest. No extra request, and the descriptor arrives on that response — so it feeds readFramed directly with no discovery cost at all. Costs some first-wave parallelism on every large read.
  3. Remember per key that an object is framed, so only the first read pays. Adds cache state and an invalidation question.
  4. Leave it. The waste is bounded, every read is correct, and reads below the threshold — the ones a FUSE mount issues most — already get the full benefit.

(2) looks best: it removes the waste, keeps the no-extra-HEAD property, and folds the encoding discovery into work the fan-out was doing anyway. It needs parallelGetObject to return the response it abandoned on rather than only errFanOutOnEncodedObject.

Not a correctness issue

Every read here returns the right bytes; objectfs-sha256 and the per-frame hashes are unaffected. This is purely the byte count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compressionarea: s3priority: mediumtype: performance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions