DataTree.to_zarr()
is very slow writing to high latency store
#9455
Labels
topic-backends
topic-DataTree
Related to the implementation of a DataTree class
topic-performance
topic-zarr
Related to zarr storage library
What is your issue?
Repost of xarray-contrib/datatree#277, with some updates.
Test case
Write a tree containing 13 nodes and negligible data to S3/GCS with fsspec:
Gives:
This is a bit better than in the original issue due to improvements elsewhere in the stack, but still really slow for heavily nested but otherwise small datasets.
Potential Improvements
#9014 did make some decent improvements to read speed. When reading the dataset written above I get:
We'll need similar optimizations on the write side. The fundamental issue is that
DataTree.to_zarr
relies on serialDataset.to_zarr
calls for each node:xarray/xarray/core/datatree_io.py
Lines 153 to 171 in 12c690f
This results in many
fsspec
calls to list dirs, check file existence, and put small metadata and attribute files in the bucket. Here'ssnakeviz
on the example:(The 8s block on the right is metadata consolidation)
Workaround
If your data is small enough to dump locally, this works great:
Takes about 1s.
The text was updated successfully, but these errors were encountered: