Skip to content

Restrict library spectra for guest users on large spectrum libraries#1226

Open
vagisha wants to merge 2 commits into
release26.3-SNAPSHOTfrom
26.3_fb_gate-large-speclibs
Open

Restrict library spectra for guest users on large spectrum libraries#1226
vagisha wants to merge 2 commits into
release26.3-SNAPSHOTfrom
26.3_fb_gate-large-speclibs

Conversation

@vagisha
Copy link
Copy Markdown
Collaborator

@vagisha vagisha commented Jun 8, 2026

Rationale

The peptide details page (targetedms-showPeptide.view) is very slow on PanoramaWeb when displaying library spectra from large EncyclopeDIA .elib libraries. 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

  • Do not show library spectra to guests when the spectrum library file is ≥ 500 MB; show the existing "Login to view this data" message instead.
  • The restriction applies to all library-read paths (the spectrum panel, the spectrum AJAX endpoint, and the chromatogram peptide-ID retention-time markers).
  • Logged-in users and small libraries are unaffected.

Co-Authored-By: Claude noreply@anthropic.com

  * 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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/org/labkey/targetedms/TargetedMSController.java Outdated
  * 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>
@vagisha vagisha marked this pull request as ready for review June 8, 2026 02:57
@vagisha vagisha requested a review from labkey-jeckels June 8, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants