Repository navigation
Conversation
MyvTsv
marked this pull request as ready for review
November 13, 2026 10:51
Rom1-B
requested review from
a team,
Mary-Clb,
RomainLvr and
jdurand-teclib
and removed request for
a team
November 18, 2026 15:07
jdurand-teclib
previously approved these changes
Nov 23, 2026
…d rule save, clean links on purge
MyvTsv
force-pushed
the
perf_optimization
branch
from
November 25, 2026 13:53
b9d8e1b to
f835220
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.
Performance Optimizations & Benchmark
This update reduces the SQL overhead of the plugin, mainly on the "Assigned to" actor dropdown of the ticket form (
filter_actorshook), on the rule form and on rule saves, and removes an unused asset loaded on every page.Key Optimizations
Actor dropdown (
filter_actorshook):glpi_groupsquery withid IN (...)instead of acountElementsInTableForEntity()plus agetFromDB()per group (thegetFromDB()result was not used).getAllGroupForALevel()(already joined withglpi_groupsand restricted to the entity) are used directly, without agetFromDB()per group.Rule form:
multipleDropdownGroup()andgetSavedValues()load the 4 levels in one query each and keep the result for the render, instead of being called once per level (8 queries → 2).Rule save:
post_updateItem()reads the current links once for all levels, then deletes only the links no longer selected and adds only the new ones, instead of deleting and re-adding every link (with its history line) on each save.Rule purge:
cleanDBonPurge()); they were left behind and reappeared as preselected groups on a later rule for the same category.Static JavaScript Assets:
public/scripts/multiple_group.jsand itsADD_JAVASCRIPThook: it was loaded on every GLPI page while its only function (toggleSelect) is not used anywhere.Database Changes
Benchmark Results
Environment: GLPI 11.0.13, e2e database with 2,000 groups, 2,000 ITIL categories, 2,000 tickets, 1,980 rules and 50,000 category-group links (20 "hot" rules carry 25,000 links, 1,250 groups each; hot tickets have 20 assigned groups). Plugin active, debug mode and Xdebug disabled. Values are the median of 5 runs after a warm-up; SQL counts come from the MariaDB query log.
ajax/actors.phpcallNote: the "After" SQL counts were measured with an extra change (removal of the
Plugin::isPluginActive()check inplugin_init) that was reverted after review, because core also loadssetup.phpof inactive plugins (plugin list page, install, activate). Expect about one more query per HTTP request than shown (S0 +33, S1 +47,ajax/actors.php+1, W1 +11); the other gains are not affected.Benchmark Analysis
Targeted Gains:
ajax/actors.phpdrops from 679 to 45 queries (34 without the plugin): the 307glpi_groupsgetFromDB()+ 307 entity counts + 20 level lookups are replaced by 2 queries. The plugin overhead on that call goes from +34 ms to +12 ms over core (44.9 ms without the plugin), and the query count no longer grows with the number of groups in the rule.Statistical Significance: the
ajax/actors.phpgain exceeds measurement noise (min–max ranges 72.6–101 ms before, 43.3–59.3 ms after). The S1 page also passes the range test, but the change only removes one cached JS file on that page, so it is mostly run-to-run variance (1,134 ms with the plugin inactive). S0, S3, S4, S5 and W1 times stay within measurement noise (overlapping ranges).Known Limitation: saving a rule with about 1,000 selected groups or more fails with HTTP 403 before and after this change, because the POST exceeds PHP
max_input_vars(1,000 by default); this is unrelated to the changes and needs a separate fix.