tifs-to-geozarr: lower default workers from cpu_count to 4#52
Merged
scottstanie merged 1 commit intoopera-adt:mainfrom Apr 24, 2026
Merged
Conversation
Default worker count was `min(len(groups), cpu_count())` — 12 on a modern laptop, 16+ on a desktop. Each reader holds one variable (plus its pyramid levels) in RAM until the writer drains it, so peak RSS scales as `(n_workers + 1) × largest_group`. On a typical dolphin stack the largest variable (3D unwrapped / filtered timeseries) is a few GB, and 13 copies is the difference between 20 GB and 90+ GB RSS. Reported by a user on a 96 GB box that still OOMed. Rasterio reads are I/O-bound and release the GIL, so 4 threads already saturate typical disk bandwidth — going higher mostly inflates memory without buying wall time. Users with small variables and plenty of RAM can override via `--workers 12`. Help text updated to make the memory tradeoff explicit. Dropped the now-unused `os` import. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
The problem
User reported
bowser tifs-to-geozarrpeaking at 96 GB RSS on a 12-core laptop with a typical dolphin stack. The(n_workers + 1) × largest_groupbound is being honoured — it's just that the default wasos.cpu_count(), so(12 + 1) × ~7 GB unwrapped stack ≈ 91 GB. Matches the reported number exactly.Fix
Drop the default to 4. That puts the bound at
5 × largest ≈ 35 GB, which fits on any reasonable dev machine.Rationale for 4:
--workers 12for full throughput.Help text on
--workersnow makes the memory tradeoff explicit:Dropped the now-unused
osimport.Test plan
bowser tifs-to-geozarr --helpshows the updated guidance🤖 Generated with Claude Code