Repository navigation
Reduce backend work during folder browsing - #114
Merged
Merged
Conversation
PaulHax
force-pushed
the
browse-performance
branch
2 times, most recently
from
October 18, 2026 23:10
a494ed1 to
38892f0
Compare
manthey
approved these changes
Oct 21, 2026
manthey
left a comment
Collaborator
There was a problem hiding this comment.
This is a strict improvement. If there is a very large tree that isn't volview loadable, I think the aggregation will still be slow. I'll dig into what else can help.
Collaborator
|
@PaulHax As far as I am concerns, this is good to merge. |
PaulHax
force-pushed
the
browse-performance
branch
from
October 22, 2026 13:47
b71e044 to
3fd9d43
Compare
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.
Issue
Girder folder browsing checks subtree loadability before showing Open Folder in VolView. This can generate substantial Python and MongoDB work without opening VolView. This addresses avoidable work in #110 after the filtering and 1,000-file limit added in #111.
The largest gains are for many rejected candidates across separate items, including large-image TIFFs, SM DICOMs, job outputs and staged processing inputs.
Sparse image trees can also benefit when browsing one or two levels above the leaf folders. Full descendant discovery still happens.
Videos and unsupported formats are already filtered before the expensive metadata checks, so folders containing only those files benefit little.
Ordinary CT folders usually succeed on the first file and see little change.
Rejected slices sharing one item already reuse cached metadata, so they also see little benefit.
Diagnosis
Each newly examined non-session item requires an item read and an inherited folder permission check. Distinct items repeatedly fetch the same folder, so rejecting many candidates can cause thousands of reads. Parent documents include unrelated metadata; cursor batches can perform joins and transfer files that an early success never needs.
The browser can also request eligibility before its VolView button exists, leaving no button to update.
Changes
Evidence
Final measurements compare
38892f0257bb2a39ea02524e6b90824658aa8bbewith remote maineeee766, using synthetic metadata, real Girder/MongoDB routes and nonadmin users.Only the cursor row holds parent checks fixed; other rows combine backend changes. Command/BSON accounting is separate from timing. Padded metadata is a stress fixture.
A ten-second mixed workload used five users, three tabs and five active jobs each. Before/after runs completed 374/374 status polls and 5/5 browsing checks, with 0/0 errors. Girder CPU changed 4.104 → 1.379 seconds, and Mongo CPU 2.058 → 0.530 seconds. One phase per revision does not establish polling-latency improvement or production capacity.
Methodology, scripts and raw samples include reproduction commands.
Tradeoffs and coverage
Smaller cursor batches add round trips: the isolated 1,000-SM-item scan takes 43.57 → 45.64 ms. Initial size one can leave a one-file cursor open for deferred cleanup, whose costs are not fully measured. Parent batching can read ahead after an early rejection.
The aggregation pipeline, permissions and 1,000-candidate limit are preserved. Full descendant discovery remains; descendant order is unspecified. These measurements do not establish the production incident's cause or actual import layout.
Regression coverage includes permissions, batch boundaries, metadata changes, button visibility, loading an image through the browser UI, and job-log preservation.