Restrict library spectra for guest users on large spectrum libraries#1226
Open
vagisha wants to merge 2 commits into
Open
Restrict library spectra for guest users on large spectrum libraries#1226vagisha wants to merge 2 commits into
vagisha wants to merge 2 commits into
Conversation
* Spectrum viewer pages were slow (6-23 s) for peptides in large .elib libraries on network storage (GPFS).
The load came from anonymous web crawlers
* Added LibrarySpectrumMatchGetter.blockSpectraForGuest (guest user + an associated .elib/.blib library file >= 500 MB)
* TargetedMSController.addSpectrumViews and LibrarySpectrumDataAction now show the existing "log in to view" prompt
(login-required error for the AJAX path) instead of reading the library
* ChromatogramDataset.getPeptideIdRetentionTimes skips the peptide-ID retention-time markers for gated guests
* Mitigation for guest/bot traffic only. Logged-in users and small libraries unchanged
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a temporary performance mitigation for PanoramaWeb: it prevents unauthenticated (guest/bot) traffic from triggering expensive spectrum-library reads when the referenced library file is large (≥ 500 MB), addressing slow peptide detail pages for large EncyclopeDIA/BiblioSpec libraries on network storage.
Changes:
- Add a size-based guest gate (
blockSpectraForGuest) that blocks spectrum/RT reads for supported library types when the library file is large. - Apply the gate to the peptide/precursor spectrum panel rendering and the spectrum AJAX endpoint.
- Apply the gate to chromatogram peptide-ID retention-time marker generation to avoid triggering large-library reads.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/org/labkey/targetedms/view/spectrum/LibrarySpectrumMatchGetter.java |
Adds guest/size gating logic for spectrum-library reads, including filesystem size checks and logging. |
src/org/labkey/targetedms/TargetedMSController.java |
Applies the guest gate to spectrum UI rendering and the spectrum data API endpoint. |
src/org/labkey/targetedms/chart/ChromatogramDataset.java |
Skips peptide-ID RT marker generation for guests when the library is large. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Removed redundant Files.exists() check in isLargeSpectrumLibrary;
Files.size() already throws for a missing file, so the extra call
was a needless second filesystem round-trip on network storage.
* Matched the spectrum AJAX login-required error text to the existing
"Login to view this data" wording from getLoginView().
Co-Authored-By: Claude <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.
Rationale
The peptide details page (
targetedms-showPeptide.view) is very slow on PanoramaWeb when displaying library spectra from large EncyclopeDIA.eliblibraries. On PanoramaWeb, library files live on network storage (GPFS). Traffic from anonymous web crawlers walking public folders with large libraries causes performance problems on the server.Root cause is that for large elib libraries we may read hundreds of rows from the SQLite elib library, one row per source file, with the needed columns (
Score,RTInSeconds,SourceFile) not in the index, so each is a separate scattered table lookup. On network storage each read is a round-trip, so a single page takes many seconds.This is a temporary mitigation: stop unauthenticated/bot traffic from triggering those slow reads on large libraries. A durable fix (build the library metadata once at import) is planned separately.
Changes
Co-Authored-By: Claude noreply@anthropic.com