You are not logged in.
Pages: 1
Hello
My plugin I made is loading very slow in GLPI 10.
In GLPI 9.5 is shows immediately.
On opening it shows an overview of the data in a mysql table.
The code in ictbestellingen.class.php
class PluginIctbestellingenIctbestellingen extends CommonDBTM {
static $rightname = "plugin_ictbestellingen";
static function getTypeName($nb=0) {
return _n('Ictbestellingen', 'Ictbestellingen', $nb, 'ictbestellingen');
}
public function getForbiddenStandardMassiveAction() {
$forbidden = parent::getForbiddenStandardMassiveAction();
$forbidden[] = 'update';
$forbidden[] = 'purge';
return $forbidden;
}
public function rawSearchOptions() {
$tab[] = [
'id' => 'common',
'name' => self::getTypeName(2)
];
$tab[] = [
'id' => '1',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'datum',
'name' => 'Datum'
];
$tab[] = [
'id' => '4',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'omschrijving',
'name' => 'Omschrijving'
];
return $tab;
}
The index.php of the plugin
<?php
include ('../../../inc/includes.php');
Html::header("Ictbestellingen", "", "plugins","pluginictbestellingenmenu");
Search::show("PluginIctbestellingenIctbestellingen");
Html::footer();
?>
In hook.php the function function plugin_ictbestellingen_giveItem($type,$ID,$data,$num) is not defined.
When definded, the loading is teh same.
This shows an overview of the the sql table glpi_plugin_ictbestellingen_ictbestellingens
-- glpi10.glpi_plugin_ictbestellingen_ictbestellingens definition
CREATE TABLE `glpi_plugin_ictbestellingen_ictbestellingens` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '''''',
`entities_id` int(10) unsigned NOT NULL,
`id_overheidsopdracht` int(11) NOT NULL,
`datum` date DEFAULT NULL,
`omschrijving` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`wijzigen` smallint(6) NOT NULL DEFAULT 0,
`verwerkt` smallint(6) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=391 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
In this table are 139 records.
In takes 4 seconds to show the overview with two columns in GLPI 10.
When all 17 columns are active, 13 columns with a linkfield, it takes over 10 seconds to show.
$tab[] = [
'id' => '19',
'table' => 'glpi_plugin_ictbestellingen_software',
'field' => 'aantal',
'linkfield' => 'id',
'name' => 'Software'
];
It takes 1 second to show the overview with 17 columns in GLPI 9.5.
Why is showing the overview so slow in GLPI 10?
Last edited by Feike (2023-02-16 12:55:13)
Offline
During testing in the last I updated through all version from 10.0.0 to 10.0.6.
The plugin never changed during this time.
This resulted in the slow load speed.
To test I started with a new GLPI 10.0.0 and used the database from our GLPI 9.5
Then updating to 10.0.2 and then every version to 10.0.6
All the time the load speed was ok.
Very strange ...
Now a week holiday and continue the testing with a fresh head.
Offline
Linking a field in glpi 9.5 was done using a linkfield to the given table, see example below.
In glpi 10 is this linkfield option deprecated or is there another way to link a field from another table?
Maybe another notation will not slow down the loading of the page.
$tab[] = [
'id' => '19',
'table' => 'glpi_plugin_ictbestellingen_software',
'field' => 'aantal',
'linkfield' => 'id',
'name' => 'Software'
];
Offline
Problem solved:
Installed a new HyperV.
A new virtual machine with windows 2022 and IIS.
PHP 8.2.4 and MariaDB 10.11
Installed a glpi 10.0.6 and took the data of our glpi 9.5
Converted the database and did the migration:... commands.
Now the speed is ok.
Offline
GLPI 10.0.6
The speed of the sql queries is ok.
Creating the page takes a lot of time.
I'm adding 18 columns in public function rawSearchOptions() and the content is given by function plugin_ictbestellingen_giveItem($type,$ID,$data,$num)
With all 18 columns it takes 13 seconds to load the page and with 3 columns it takes only 2.6 seconds to load the page.
The sql speed is going from 0.3 seconds to 0.1 seconds, so the sql queries can't be the issue.
In glpi 9.5 there was no speed issue for this plugin.
What is causing this delay?
Any ideas out there?
Offline
You probably aren't going to get much help with understanding performance issues with a private plugin that nobody else has the code for or can install and test.
What are you doing in the `giveItem` hook function for each field? Usually only certain types of fields really need custom handling this way and it seems odd that every one of them needs it.
Are all 18 custom fields displayed in the search results?
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Online
All 18 custom fields are displayed in the search result.
In the 'giveItem', 3 fields are displayed as a link, 13 fields will shown a numeric value depending on the result of a query, colored black or red.
Even when I don't use 'giveItem' showing all 139 records takes a the same amount of time.
Three possible options:
1) stay with version 9.5
2) show less columns
3) show less records
All columns must be shown, so that's no option.
So option 3 is the most interesting option.
Is there a hook function to add a where clause to show less records?
Otherwise the use must filter the result himself.
public function rawSearchOptions() {
$tab[] = [
'id' => 'common',
'name' => self::getTypeName(2)
];
$tab[] = [
'id' => '1',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'datum',
'name' => 'Datum'
];
$tab[] = [
'id' => '4',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'omschrijving',
'name' => 'Omschrijving'
];
$tab[] = [
'id' => '5',
'table' => 'glpi_entities',
'field' => 'name',
'linkfield' => 'entities_id',
'name' => 'Instantie'
];
$tab[] = [
'id' => '6',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalDesktop',
'name' => 'Desktop'
];
$tab[] = [
'id' => '7',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalLaptop',
'name' => 'Laptop'
];
$tab[] = [
'id' => '8',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalBeamer',
'name' => 'Beamer'
];
$tab[] = [
'id' => '9',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalPrinter',
'name' => 'Printer'
];
$tab[] = [
'id' => '10',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalServer',
'name' => 'Server'
];
$tab[] = [
'id' => '11',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalNetwerk',
'name' => 'Netwerk'
];
$tab[] = [
'id' => '12',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalTablet',
'name' => 'Tablet'
];
$tab[] = [
'id' => '13',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalSmartphone',
'name' => 'Smartphone'
];
$tab[] = [
'id' => '14',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalGeheugen',
'name' => 'Geheugen'
];
$tab[] = [
'id' => '15',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalSwitchkast',
'name' => 'Switchkast'
];
$tab[] = [
'id' => '16',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalSmartboard',
'name' => 'Smartboard'
];
$tab[] = [
'id' => '17',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalVaria',
'name' => 'Varia'
];
$tab[] = [
'id' => '18',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'wijzigen',
'name' => 'Wijzigen'
];
$tab[] = [
'id' => '19',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'aantalSoftware',
'name' => 'Software'
];
$tab[] = [
'id' => '20',
'table' => 'glpi_plugin_ictbestellingen_ictbestellingens',
'field' => 'verwerkt',
'name' => 'Verwerkt'
];
return $tab;
}
Last edited by Feike (2023-04-24 09:58:52)
Offline
Pages: 1