Skip to content

[main] Perf: read the configuration once per request - #186

Draft
glpi-project[bot] wants to merge 1 commit into
mainfrom
forward-port/180-to-main
Draft

glpi-project[bot] wants to merge 1 commit into
mainfrom
forward-port/180-to-main

Conversation

@glpi-project

@glpi-project glpi-project Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Forward-port of #180 to main.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.

Description

Each generated number read the plugin configuration again: 9 queries per asset. The generation switch, the per-type rows and the enabled itemtypes are now read once per request. The cache is cleared when a configuration is saved, added or removed. The counter and its reset date are still read from the database for each number.

Benchmark

GLPI 11.0, 2 000 computers, generation on for computers.

Scenario SQL before SQL after Time before Time after
Massive action "Regenerate inventory number", 50 computers 1 142 queries (450 on plugin tables) 844 (152) 940 ms 925 ms (not significant)
Computer creation (number generated), plugin queries 7 5 39 ms within noise

This is a small gain: most of the time is GLPI updating each asset.

Tests

A new test changes the template and the generation switch between two generations in the same process. It checks that each change is seen and that the numbers stay consecutive.

@glpi-project

glpi-project Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin forward-port/180-to-main
git worktree add --checkout .worktree/forward-port/180-to-main forward-port/180-to-main
cd .worktree/forward-port/180-to-main
git reset --hard HEAD^
git cherry-pick -x b1d348a7920035eed14499d26aff8dd2ffdf8517

@glpi-project glpi-project Bot mentioned this pull request Dec 1, 2026
3 tasks done
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.

1 participant