Read Zarr through the range reader: merged shard reads, per-read cancellation, a cache shared with COGs

Aperta
#855 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
32/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Start with the linked spec on the kyle/zarr-range-reader branch and review the range-reader and deck.gl-zarr integration points described in the issue: rangeReaderFetch, ZarrSource.open, createFetchStore, and the metadata/data classifier. Compare the proposed behavior with the existing COG reader and Zarr cancellation/coalescing behavior. Done means the three benchmark cases meet the request, cancellation, cache, and load-time criteria listed in the issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

zarr

[!NOTE]
This issue was written by Claude (Claude Code), not by @kylebarron.

Zarr reads don't go through @developmentseed/range-reader, so they miss what COG reads gained in 0.10: merged requests, a shared byte cache, a per-origin request limit, and cancellation per read. This issue tracks the adapter that adds them. Its design is in the spec on the kyle/zarr-range-reader branch, which hasn't been reviewed yet.

Today

A sharded array reads through zarrita's sharding codec: a read for the shard index, then one getRange per inner chunk. Each is its own HTTP request unless the app wraps the store in zarrita's withRangeCoalescing, which:

  • merges the reads of one microtask with a fixed 32 KiB gap and no cap on a merged request, and keeps no cache;
  • combines the abort signals of every read it merges, so one tile leaving the view fails the reads of every tile merged with it (the class of bug in #690);
  • shares no cache, request limit or batching window with the page's COG layers.

Because of that abort behavior, ZarrLayer keeps deck.gl's limit of six requests at a time and deck.gl's abort rule.

Plan

Two stacked PRs, as in the spec:

  1. range-reader: rangeReaderFetch(reader, options), a fetch-shaped function that turns a request into a reader read and the result back into a Response. zarrita's FetchStore and icechunk's fetchClient both take one, so neither needs a store class of its own. HEAD requests, conditional headers and other Range forms pass through to fetch unchanged.
  2. deck.gl-zarr: a URL form of ZarrSource.open, createFetchStore(url, { reader, requestInit }) for apps that build their own store, and a classifier that tells metadata reads from data reads. A layer whose source was opened from a URL behaves like COGLayer: it aborts tiles that leave the view and defaults to maxRequests: 256 and debounceTime: 50. A source opened from an app-built store keeps today's behavior. The icechunk example passes the adapter as its fetchClient.

Changes since the spec

  • #837 put DEFAULT_RANGE_READER in @developmentseed/deck.gl-raster, which deck.gl-zarr already depends on, so the spec's defaultRangeReader() in range-reader isn't needed. DEFAULT_CONCURRENCY_LIMITER is still in deck.gl-geotiff, so the limiter needs a home that deck.gl-zarr can import from.
  • #838 changed ZarrSource.open to take a store and a path. The URL form becomes ZarrSource.open(url, { path }).
  • The spec says a tile is one shard of 100 inner chunks. It's one inner chunk: ZarrLayer tiles by zarrita's arr.chunks, which for a sharded array is the inner chunk shape. So reads merge across neighbouring tiles of a shard, not within a tile.
  • The spec's sharded benchmark, dynamical-zarr-ecmwf, has inner chunks of about 2.3 MB compressed. That's more than the reader's default maxRequestBytes of 1 MiB, so they won't merge. The example still measures cancellation and caching, but measuring the merging needs a sharded store with smaller inner chunks.

Done when

Measured with the COG benchmark harness, before and after:

  • A sharded store with small inner chunks makes fewer requests per view, and panning back refetches nothing that fits the cache budget.
  • dynamical-zarr-ecmwf: a fast pan leaves no selected tile blank and raises no unhandled AbortError, and load time at least matches today's.
  • zarr-sentinel2-tci (unsharded) and nldas-icechunk: requests and times within noise of today's.

🤖 Written by Claude Code

Lingua principale
TypeScript
Stelle
240
Fork
34
Merge medio
17h 24m
PR unite (30g)
62

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di developmentseed/deck.gl-raster

Tutte le issue di developmentseed/deck.gl-raster

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.