open_remote: keep fetched blocks (fsspec blockcache) on windowed reads - #57
Merged
Merged
Conversation
A windowed read (one with a block_size) now opens with cache_type='blockcache' instead of fsspec's default one-block 'readahead'. Reading a range out of a chunked, compressed HDF5 file comes back to blocks it has already fetched, and with one cached block each return was another S3 request: measured on MAAP-ADE 2026-09-25, an ATL11 range read of ~1,400 points fetched ~30 MB (7 MB with the block cache), and whole prelim tiles read 1.71 -> 0.26 GB (IS), 4.37 -> 0.58 GB (GL), 9.90 -> 1.54 GB (AA), 1.9-2.8x faster, with identical data. Memory is only the blocks a read touches, up to DEFAULT_REMOTE_CACHE_BYTES (1 GiB) per open file. Reads without a block_size keep the filesystem's defaults. A filesystem whose open() takes no cache_type still gets its block_size. Also corrects the docstring: s3fs's default block is 50 MiB. tests/test_remote_cache.py uses a real fsspec filesystem over local bytes that counts fetched bytes; it fails without the change. (Two tests in test_cloud* about a missing remote index fail on main already, unrelated.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A windowed read (one with a block_size) now opens with cache_type='blockcache' instead of fsspec's default one-block 'readahead'. Reading a range out of a chunked, compressed HDF5 file comes back to blocks it has already fetched, and with one cached block each return was another S3 request: measured on MAAP-ADE 2026-09-25, an ATL11 range read of ~1,400 points fetched ~30 MB (7 MB with the block cache), and whole prelim tiles read 1.71 -> 0.26 GB (IS), 4.37 -> 0.58 GB (GL), 9.90 -> 1.54 GB (AA), 1.9-2.8x faster, with identical data.
Memory is only the blocks a read touches, up to DEFAULT_REMOTE_CACHE_BYTES (1 GiB) per open file. Reads without a block_size keep the filesystem's defaults. A filesystem whose open() takes no cache_type still gets its block_size. Also corrects the docstring: s3fs's default block is 50 MiB.
tests/test_remote_cache.py uses a real fsspec filesystem over local bytes that counts fetched bytes; it fails without the change. (Two tests in test_cloud* about a missing remote index fail on main already, unrelated.)