Skip to content

Parallelize the opt-in metadata-consolidation path (deferred from #191/PR #193) #194

Description

@espg

🤖 from Claude

Summary

Follow-up to #191 / PR #193, which made zarr.consolidate_metadata opt-in (output.consolidate_metadata: true, default false). When it is requested, consolidation still reads the store's ~4,102 zarr.json metadata objects serially (~17 ms/GET → ~70 s on the o9 NEON store). This tracks making the opt-in path fast so it isn't a foot-gun.

Why it was deferred (not done in PR #193)

zarr==3.2.1's consolidate_metadata(store, path=None, zarr_format=None) exposes no concurrency parameter — the only lever is the global zarr.config['async.concurrency'] (default 10). Whether raising that actually parallelizes the ~4,102-object serial-GET path can't be verified without the production store the #180 measurements ran against. Per #191's own guidance ("if it doesn't expose concurrency cleanly, don't fight it — note the finding and defer; do not add a dependency"), PR #193 shipped the default-skip and deferred this. The opt-in path is off by default, so today this is latent, not a live foot-gun.

Options to evaluate

  1. Measure zarr.config['async.concurrency'] against a real consolidated run — does bumping it from 10 collapse the ~70 s? If so, the fix is a one-line config set inside the opt-in branch (no new code, no dep). Cheapest if it works.
  2. Bounded-pool reimplementation — enumerate the metadata objects and fetch them through a ThreadPoolExecutor (or a concurrent obstore batch), then assemble the consolidated blob. More code, but independent of whatever consolidate_metadata does internally. Reuses the store/obstore stack already in the repo — no new dependency.
  3. Upstream — if zarr's own path is the bottleneck and async.concurrency doesn't reach it, note it for a zarr-python feature ask (a concurrency arg on consolidate_metadata), alongside the metadata-op-storm ask on Sharded CSR writes issue a per-array metadata-op storm — upstream ask: a no-probe / batch array-creation path in zarr-python #189.

Acceptance (when picked up)

  • output.consolidate_metadata: true still produces a valid consolidated store, now via parallel metadata reads.
  • Measured wall-time drop on a representative store (target ~70 s → single-digit seconds).
  • No new dependency added without discussion (§4).
  • Read-parity unaffected (the consolidated blob's contents are unchanged; only how it's assembled).

Refs: #191 (opt-in decision), PR #193 (the default-skip that landed), #180 (the ~70 s serial-read measurement + wall-time breakdown), #189 (the related write-side metadata-op storm).

Filed for triage — no action label applied; label implement/plan/discuss to bring it into scope.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions