Conversation
|
Sorry Julia, fat fingers, did mark this by accident. |
|
Those are indeed eye-popping improvements! Where (and how) is this cache maintained? We should be careful here because Xarray maintains an internal cache in |
Yeah I was worried about that too at first. But by caching here I don't think it means file cache. I think it's more about specifying how large the requests are (ref: https://filesystem-spec.readthedocs.io/en/stable/api.html#readbuffering). It looks like the contents of each block are just stored in the To be clear there already was "caching" happening by default for this case, it was just "readahead" instead of "blockcache". |
Indeed. fsspec will use a 50MB read-ahead cache by default. In extreme cases this can result in a lot of extra requests that fetch a lot of extra data. The block cache is more resilient to sub-optimal file layouts where metadata chunks are scattered around a file and not always ordered sequentially. |
👏🏾 👏🏾
Great! |
| # Use blockcache with size 4MB by default | ||
| if "cache_type" not in open_kwargs: | ||
| open_kwargs["cache_type"] = "blockcache" | ||
| if ( |
dcherian
left a comment
There was a problem hiding this comment.
LGTM but I defer to @kmuehlbauer
kmuehlbauer
left a comment
There was a problem hiding this comment.
@jsignell LGTM, too!
Changes the default cache type when passing the path as a string to
open_datasetandopen_datatreewith theh5netcdfengine. This represents a significant improvement when opening optimized hdf5 files. This idea is based off the work that @betolink has been doing in earthaccess (earthaccess-dev/earthaccess#1061)whats-new.rstContext
This idea came up in conversation with @maxrjones and @hrodmn. It seems to represent a big improvement on the default behavior for certain giant hdf5 stores - in particular NISAR. @hrodmn double checked the performance on this branch and saw significant improvement for NISAR data when opening data from the within the same region:
open_datatreeon this PR 3.5s, on main: 51.9sopen_dataseton this PR 1.3s, on main: 41.5sopen_dataarrayon this PR 0.9s on main: 48.4s