Skip to content

fix: open each dataset once per request - #171

Open
maxrjones wants to merge 3 commits into
mainfrom
fix/single-open-per-request
Open

maxrjones wants to merge 3 commits into
mainfrom
fix/single-open-per-request

Conversation

@maxrjones

Copy link
Copy Markdown
Member

This PR keeps readers open for the duration of the backend, to be shared for both validation and rio-tiler's calls. It also makes it so URLs provided multiple times to the mosaic route share one reader.

This is motivated by poor performance observed in the AIR4US portal, which Slesa tracked to multiple openings of the same dataset. This is expensive in high-latency environment, especially for Icechunk stores where opening is a more expensive operation.

Separately, we could explore sharing open datasets across requests, but that requires a more comprehensive solution.

Testing

  • A new test fixture that monitors duplicate openings of a dataset.

PR checks

  • Standard CI runs automatically on each push.
  • To run the CDK synth check, add the run-cdk-checks label to this PR.
  • If you push more commits after that run completes, remove and re-add the label to run it again.
  • To trigger a dev deployment, add the deploy-dev label. It smoke-tests tiles from the native MUR, virtual MUR, and virtual NLDAS Icechunk stores after deployment.

maxrjones and others added 3 commits October 2, 2026 15:46
XarrayMosaicBackend opened every source to validate mosaic
compatibility, closed it, and rio-tiler's tile/part/point paths then
opened it again. For a large Icechunk store each open costs ~1.5s,
which doubled tile and point latency.

Keep the validation readers open for the life of the backend, route
rio-tiler's per-asset reader calls to them, and close them when the
request's backend context exits (or when validation fails part-way).
Duplicate URLs now share one reader.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
/info?show_times=true opened the dataset a second time to read its
time coordinate; read it from the reader the mosaic backend already
holds open.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added the fix label Oct 2, 2026

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant