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

オープン
#1,293 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@melroy89 がすでに取り組んでいます。

2026年11月22日 から。

  • #1292 @melroy89 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
databases, php, sql

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
JavaScript
スター
134
フォーク
71
平均マージ
18時間 56分
マージ済み PR(30日)
33

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextcloud/serverinfo のほかの issue

nextcloud/serverinfo の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。