
A weather dashboard reads one complete map at noon. An analyst reads the same eight-by-eight patch at every time step. Both use the same dataset, yet a Zarr chunk shape that saves requests for the dashboard can make the analyst fetch the entire array for a small answer.
We wrote the same array to an S3-compatible test bucket twice, keeping the number of objects and the bytes per chunk identical. Reading a complete map took 4 chunk requests with one layout and 16 with the other. For a patch spanning all eight time steps and crossing two spatial boundaries, the counts switched to 32 and 8. Here’s how to work out which layout suits your reads.
Our array has eight time steps, 128 rows and 128 columns. Each value is a four-byte integer. The map layout stores one time step and a 64-by-64 square per chunk. The tile layout stores four time steps and a 32-by-32 square. Both shapes contain 4,096 values per chunk. Each array occupies 32 chunk objects, each exactly 16 KiB.
We used Zarr v3 with one chunk per object, little-endian integers and compression disabled. Those choices make it possible to translate each chunk read into an exact payload size. A sharded array can pack several chunks into one object, so its request pattern needs a separate measurement. The Zarr performance guide explains how chunking and sharding interact.
Save the layout definitions as layouts.py. The dimension names make the order explicit wherever someone opens the data later.
import zarr
from zarr.codecs import BytesCodec
SHAPE = (8, 128, 128) # time, row, column
LAYOUTS = {"map": (1, 64, 64), "tile": (4, 32, 32)}
def write_layout(store, chunks, values):
array = zarr.create_array(
store=store, shape=SHAPE, chunks=chunks,
dtype="int32", dimension_names=("time", "row", "column"),
zarr_format=3, serializer=BytesCodec(endian="little"),
filters=(), compressors=None,
)
array[:] = values
Save the three selections as windows.py. Python excludes the stop position in a slice. The range 60:68 therefore covers coordinates 60 through 67. It straddles the boundary at 64 on both spatial axes. The equally sized range 64:72 starts on that boundary and fits inside one spatial tile.
import zarr
QUERIES = {
"map": (slice(3, 4), slice(0, 128), slice(0, 128)),
"boundary": (slice(0, 8), slice(60, 68), slice(60, 68)),
"aligned": (slice(0, 8), slice(64, 72), slice(64, 72)),
}
def read_slice(store, selection):
array = zarr.open_array(store=store, mode="r", zarr_format=3)
return array[selection]
For a full map at time index 3, the map layout needs two chunk rows and two chunk columns, giving four objects. The tile layout needs four rows and four columns, giving 16 objects. For the boundary-crossing patch, both layouts intersect two rows and two columns of chunks. The difference is time. The map layout must visit eight time chunks, giving 8 × 2 × 2 = 32 objects. The tile layout needs two time chunks, giving 2 × 2 × 2 = 8.
We ran Zarr-Python 3.4.2 with s3fs 2026.9.0 against a local Moto S3 emulator. A fresh Python process opened each layout for each query. We logged the HTTP requests at the storage endpoint, compared the requested object keys with the predicted coordinates, and checked every returned value against the corresponding NumPy slice.
Each cold read also fetched zarr.json once. This adapter issued one HEAD for that metadata object and one HEAD per chunk. For example, the four-chunk map read made ten HTTP requests in total. We observed no repeated or failed chunk GETs. All six reads returned the expected values. These byte counts cover chunk payloads. HTTP headers and metadata are accounted for separately from the array data.
The two helpers below connect the same experiment to an S3-compatible endpoint. Save them as stores.py and compare.py. Install Zarr, NumPy and s3fs, configure the credentials for your test bucket, then call compare("s3://my-test-bucket/chunk-trial", endpoint) with your own unused bucket prefix and endpoint URL. The function writes both arrays under that prefix. The Zarr storage guide describes how the adapter opens remote stores.
from contextlib import contextmanager
from zarr.core.sync import sync
from zarr.storage import FsspecStore
@contextmanager
def open_store(uri, endpoint, **options):
store = FsspecStore.from_url(
uri, storage_options={
"endpoint_url": endpoint,
"skip_instance_cache": True,
"use_listings_cache": False,
**options,
},
)
client = sync(store.fs.set_session())
try:
yield store
finally:
sync(client.close())
store.close()
import numpy as np
from layouts import LAYOUTS, SHAPE, write_layout
from stores import open_store
from windows import QUERIES, read_slice
def compare(prefix, endpoint, **options):
values = np.arange(np.prod(SHAPE), dtype="<i4").reshape(SHAPE) + 1
for name, chunks in LAYOUTS.items():
uri = f"{prefix.rstrip('/')}/{name}"
with open_store(uri, endpoint, **options) as store:
write_layout(store, chunks, values)
for selection in QUERIES.values():
with open_store(uri, endpoint, **options) as store:
result = read_slice(store, selection)
np.testing.assert_array_equal(result, values[selection])
Use the comparison to verify values. To measure requests, clear the write traffic from your log, start each read in a fresh process, and count successful chunk GETs separately from metadata, retries and failed requests. We used this procedure for all six reads on the local endpoint. Compression can also change the bytes per object. If your input starts in columnar files, the Parquet compression guide covers how to measure that separate decision.
Suppose your workload contains only the full map and the boundary-crossing patch. Two map reads plus one patch read would require 40 chunk GETs with either layout (4 + 4 + 32 versus 16 + 16 + 8). Above two maps per patch, the map layout wins on chunk requests. Below that ratio, the tile layout does. A different window size, alignment or cache policy changes the calculation.
Before writing a full dataset to Object Storage with Hivenet, replay a sample of real selections against two disposable prefixes. Record chunk requests, transferred bytes and elapsed time separately. The local experiment measures request count and payload. Your endpoint, compression and concurrency determine what those differences mean for response time.
Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.