You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A decoded-chunk cache for v3 reads (revisiting the v2-era #278 / #306) #4306
zarr-python 2 had LRUStoreCache; v3 currently has no caching layer, so every read decodes every chunk it touches, in full. Any consumer with overlapping reads pays the cliff.
Measured on a chunked OME-Zarr store read in sliding slabs (zarr 3, local NVMe): the same 2.1 GB of useful bytes cost 1.9 s when read in 256-row slabs and 28 s in 6-row slabs, a 15x penalty, because neighbouring slabs re-decode the same chunks over and over.
This was discussed in the v2 era: #278 asked for exactly this and #306 implemented a ChunkCache holding decoded chunks passed to Array (never merged), and #382 sketched layered caching. The v3 architecture seems friendlier to it than v2 was.
What we run in production and would be glad to upstream: a byte-capped decoded-chunk cache around Array reads (post-decode, so a hit is a memcpy), default off, with an optional eviction hook so an application that knows its read schedule can supply Belady-style eviction. With the hook, our workload's decode count drops from 148 (plain LRU) to 138, against a theoretical floor of 126.
Is there current interest in a v3 chunk cache, and would a design along those lines (cache on the Array, byte cap, optional eviction callback) be considered? I can open a PR with the implementation and the benchmarks.
zarr-python 2 had LRUStoreCache; v3 currently has no caching layer, so every read decodes every chunk it touches, in full. Any consumer with overlapping reads pays the cliff.
a cache for decoded chunks is a very good idea. but we would need to find the right home for it -- caching could be a feature of codecs, the codec orchestration layer, or the array layer. Or we make the public API commitment vanishingly small so we can be agile about where the caching functionality actually lives.
Note that we are considering some big changes internally ahead of wrapping zarrista: see #4217. So if you have the time for this, I would encourage thinking about how chunk caching could work in the next iteration of our internal APIs, although they have not been entirely fleshed out yet.
Activity
d-v-b commentedon Sep 2, 2026
we have a cache for the storage layer, see https://zarr.readthedocs.io/en/stable/api/zarr/experimental/#zarr.experimental.cache_store
a cache for decoded chunks is a very good idea. but we would need to find the right home for it -- caching could be a feature of codecs, the codec orchestration layer, or the array layer. Or we make the public API commitment vanishingly small so we can be agile about where the caching functionality actually lives.
Note that we are considering some big changes internally ahead of wrapping zarrista: see #4217. So if you have the time for this, I would encourage thinking about how chunk caching could work in the next iteration of our internal APIs, although they have not been entirely fleshed out yet.