Server Info’s slowest-jobs refresh gets expensive as job history grows

Aperta
#1,293 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@melroy89 ci sta già lavorando.

Dal 22/11/2026.

  • #1292 di @melroy89 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
databases, php, sql

Direzione di ricerca

The slow query joins job_runs with job_classes_registry during the Slowest jobs refresh, run via php occ serverinfo:update-job-statistics. Measure the query on a large fixture before changing it, and compare results with the proposed grouped-by-class version. Work is already under way in PR #1292, so review or build on that branch rather than starting a parallel fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

1. to develop enhancement
Problem

Server Info periodically refreshes the Slowest jobs summary. The refresh joins every retained job run with the job-class registry before calculating per-class statistics.

On instances with a large job history, this repeats the same class lookup hundreds of thousands of times.

I observed this in the MariaDB slow query log on two installations (yes I have two nextcloud instances) running Nextcloud 35.0.x, Server Info 7.0.0, and MariaDB 10.11.14.

Instance Query time Rows examined
Main instance 411–531 ms Up to 630,000
Second instance 267–317 ms Up to 420,000
Steps to reproduce
  1. On a test instance with a large retained job history, run php occ serverinfo:update-job-statistics.
  2. Check the timing and rows examined for the query joining job_runs and job_classes_registry.
Proposed improvement

Group completed runs by class ID first, then look up each class name once. This preserves the statistics and excludes running jobs and runs whose class is missing from the registry.

On a local MariaDB fixture with 630,000 retained runs, median query time fell from 209 ms to 124 ms across ten alternating runs. All 92 result rows matched. The query still reads the retained history, but it performs far fewer registry lookups.

-> Proposed fix in PR #1292

Lingua principale
JavaScript
Stelle
134
Fork
71
Merge medio
18h 56m
PR unite (30g)
33

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/serverinfo

Tutte le issue di nextcloud/serverinfo

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.