Skip to content

Check downstream impact of the chunk layout from #277 (1024 chunks, single-chunk overviews) #282

Open

Description

@emmanuelmathot

Check downstream impact of the chunk layout from #277 (1024 chunks, single-chunk overviews)## Context

In #277, @lhoupert raised that overview chunks now come from the parent level's dask chunks, not from spatial_chunk:

Sharded (as data-pipeline runs it), r120m is a single 915×915 chunk, so a 64×64 tile read decodes ~2.5 MB instead of 102 KB on main. Unsharded, r720m ends up as 64 chunks of 21×21.

@shollendEODC replied that EODC production requires a uniform 1024 × 1024 chunking. _rechunk_ds() rechunks the whole tree before the multiscale step, so the overviews inherit it.

We expect little or no downstream impact, but nobody has checked. This issue records Loïc's point and the check.

Layout today

S2 L2A reflectance, sharded. Values are from the snapshot fixtures: main (test with spatial_chunk=256) against #277 (test with spatial_chunk=1024):

Level Shape main: shard / inner chunk #277: shard / inner chunk
r10m 10980² 10980² / 244² 11264² / 1024²
r20m 5490² 5490² / 183² 6144² / 1024²
r60m 1830² 1830² / 183² 2048² / 1024²
r120m 915² 915² / 183² 915² / 915² (one chunk)
r360m 305² 256² / 256² 305² / 305² (one chunk)
r720m 152² 152² / 152² 152² / 152²

Notes:

  • The layout depends on spatial_chunk, not only on feat!: reintegrate cpm-geozarr into main #277. Our production S2 template (platform-deploy, eopf-explorer-convert-v1-s2-template.yaml) does not pass --spatial-chunk, so it uses the CLI default of 256. EODC runs with 1024.
  • With 1024, one uint16 inner chunk is 2 MiB before compression, compared with about 116 KiB for 244² and 65 KiB for 183². The smallest read unit is the inner chunk, including inside a shard.
  • Without sharding, the overviews can end up with many very small chunks (Loïc: 64 chunks of 21² at r720m).

What to check

For each consumer, compare tile latency, bytes read and memory, for spatial_chunk=256 against 1024, at native zoom (r10m) and at overview zooms (r120m–r720m):

  • titiler-eopf: XYZ tiles (256 and 512 px) and a rescale true-colour request. Reads go through zarr-python; check bytes fetched per tile and response time.
  • Viewer, OpenLayers GeoZarr source via zarrita: reads in the browser, so larger inner chunks mean more download and more decode per displayed tile. Check network bytes per tile and time to first render at low zoom (r120m and r360m become one chunk).
  • titiler-openeo / openEO Studio: processing graphs over a small AOI; check bytes read.
  • Notebooks and the foss4g workshop (zarrita exercise): only check that nothing assumes a chunk size.

Expected outcome

Related: #222, #243, #277.

Activity

  1. shollendEODC commented on Sep 28, 2026

    @shollendEODC
    Collaborator

    Sounds good, we are also starting our own internal benchmarking (including read-times a comparison of consolidated_metadata in root and measurements). We can report here or in another issue, depending on the results

  2. emmanuelmathot commented on Sep 28, 2026

    @emmanuelmathot
    ContributorAuthor

    Here is perfect. Thx @shollendEODC 🚀

  3. lhoupert commented on Sep 28, 2026

    @lhoupert
    Contributor

    Hi all, I asked Claude to do a quick check on one granule that exists in both layouts on the same OVH S3 endpoint: S2B_MSIL2A_20260920T112109_N0512_R037_T29SPB_20260920T151606 in sentinel-2-l2a and in sentinel-2-l2a-samples-zarr3-ovh. I just ran it on band b04 only, median of 4 reads, from a laptop:

    Read DevSeed @256 EODC @1024
    r10m, 256-px window 333 KiB, 5 requests ~2 MiB, 2–3 requests
    r10m, 512-px window 720 KiB, 10 requests 2.6 MiB, 3 requests
    r120m, 256-px window 186 KiB 816 KiB (the whole level is one chunk)
    r360m 97 KiB 94 KiB

    Some findings from Claude:

    • titiler: 2–6× more bytes per read but fewer requests (the Explorer's XYZ layers use 512-px tiles, the low end). Probably fine; not measured in-cluster yet.
    • Client-side viewer (OpenLayers GeoZarr source): this is where it could hurt. ol 10.9 picks its tile size from the shard and inner-chunk shapes and falls back to 64-px tiles when an inner chunk is larger than 512 px. Each 64-px tile then decodes a whole 1024² chunk (256× the pixels it draws); zarrita has no chunk cache.
    • Since feat!: reintegrate cpm-geozarr into main #277, with sharding, r120m and r360m are one chunk whatever spatial_chunk is, so r120m gets 64-px tiles too.

    @shollendEODC: could the overview inner chunks be capped at 512 or less? And is 1024 at r10m–r60m a hard requirement? If not, could we use 512?

  4. emmanuelmathot commented on Sep 29, 2026

    @emmanuelmathot
    ContributorAuthor

    @lhoupert 1024 px has been agreed early in the project. That call has been made by ESA as the best trade-off between data requets size and roundtrips. We used 256px for exploration but we knew 1024px chunk would be the default. I believe the trade-off upside is less requests made. On the other hand, sharding was not an option at that time (zarr v2) but may now be a trade-off new parameter to decide the best chunking size.

  5. shollendEODC commented on Sep 29, 2026

    @shollendEODC
    Collaborator

    Yeah 1024 (or 2048, but thats discarded) is defined in our project requirements, so we would stick with it. 3dim arrays are chunked along the polarization (1, 1024, 1024) for S1 but sharded together in a single file.

  6. lhoupert commented on Sep 29, 2026

    @lhoupert
    Contributor

    Thanks both that settled it.

    For the viewer: with 1024-px chunks, OpenLayers (10.10) draws the map in small 64-px tiles and has to read and unpack the whole 1024-px chunk for each tile. So the same chunk can be unpacked up to 256 times. I'll check whether the Explorer draws these items this way or through titiler, and follow up on the viewer side.

    OpenLayers main already fixes this (openlayers/openlayers#17602), but it isn't released yet. cc @ahocevar

  7. m-mohr commented on Sep 30, 2026

    @m-mohr

    Quick oite that ol-stac and STAC Browser (latest released versions of each) already use the unreleased GeoZarr source. So no issues in those tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

chunkingChunk and shard layoutquestionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions