User Tools

Site Tools

:: Latest version ::



This shows you the differences between two versions of the page.

Link to this comparison view

latest:admin:performance [2019/01/09 16:40]
latest:admin:performance [2020/04/15 15:23] (current)
Line 1: Line 1:
 +====== Tuning iTop Performance ======
 +In order to enhance the performance of your iTop server, you must first find the bottleneck. Is it the PHP execution of the pages which is too slow, or is it MySQL? ​
 +The real tuning of the application'​s performance requires deep-dive into the actual usage pattern of your iTop instance, however there are few generic points to check:
 +===== Install APCu =====
 +If it is available on your system, install and enable APCu ([[http://​​manual/​en/​book.apc.php|Alternative PHP Cache]]). APC speeds-up PHP applications by caching the result of the PHP parsing as opcodes in shared memory. Moreover, iTop uses APC for caching a lot of its internal structures in memory instead of rebuilding them at each page load.
 +Installing APCu will improve the overall responsiveness of the application,​ which is especially important for "​small"​ pages.
 +If not available, iTop implements a simple caching mechanism based on files.
 +<code php php.ini>
 +  [apcu]
 +  apc.shm_size=128M
 +  apc.ttl=7200
 +===== Install FPM =====
 +To improve performance you can use php-fpm with fastcgi.
 +Observations du timeout avec Apache + FPM
 +·       Le Timeout vient d’apache, via la directive ProxyTimeout. Si cette valeur n’est pas renseignée,​ Apache utilisera la directive TimeOut (par défaut 60secs).
 +·       La requête ajax renvoie bien une erreur 504 (Timeout).
 +·       Les séquences ajax suivantes ne sont pas lancées, il faut deviner quand c'est terminé et re-lancer l'​install.
 +·       Le processus d’installation est robuste, lorsque l’upgrade de la base est lancé, il va se terminer, malgré le Timeout apache. Si on relance un setup, il ne lancera pas de nouvelles requêtes, mais attendra la fin des requêtes en cours.
 +·       Si redémarrage de mysql pendant le setup: mysql rollback et repart sur la table d'​avant,​ pas de lenteur, pas de pertes de données.Points de warning :·       On ne sait pas quand le processus de setup va se terminer après avoir eu le timeout. Solution actuelle, aller vérifier les process en cours de Mysql, attendre la fin et relancer un setup.
 +·       ​Attention à l’espace disque. Un alter table nécessite d’avoir la taille de la table en espace disque disponible. Exemple une table attachement de 7Go nécessitera d’avoir au moins 7Go d’espace disque disponible (prendre aussi en compte dans l’espace disponible le backup d’iTop lui-même, si case cochée à l’upgrade)
 +·       Mode Maintenance et ReadOnly : Sur un « petit » serveur, les requêtes SQL vont prendre tellement de ressources que la visu d’iTop en ReadOnly sera difficilement exploitable.
 +===== Configure Apache Modules: Headers & Expires =====
 +Activate apache'​s modules:
 +<code bash>
 +  a2enmod expires
 +  a2enmod headers
 +Configure them:
 +<code php apache2.conf>​
 +<​IfModule mod_expires.c>​
 +  ExpiresActive On
 +  ExpiresByType image/​gif ​ A172800
 +  ExpiresByType image/jpeg A172800
 +  ExpiresByType image/​png ​ A172800
 +  ExpiresByType text/​css ​  ​A172800
 +  ExpiresByType text/​javascript A172800
 +  ExpiresByType application/​x-javascript A172800
 +<​IfModule mod_headers.c>​
 +  <​FilesMatch "​\.(gif|jpe?​g|png|css|swf|js)$">​
 +    Header set Cache-Control "​max-age=2592000,​ public"​
 +  </​FilesMatch>​
 +===== Upgrade to PHP 7 =====
 +We have noticed that PHP7 brings a lot of performance improvement on iTop.
 +===== Check MySQL'​s Key cache =====
 +Make sure that MySQL has enough memory for **caching all its indexes** in memory. The important status variables are: ''​key_read_requests''​ and ''​key_reads''​.
 +The actual ratio of ''​key_reads / key_read_requests''​ should be as low as possible (typically less than 0.1 %). If this ratio is too high, this means that you should increase the amount of memory allocated to cache MySQL'​s indexes (adjust the variable ''​key_buffer_size''​ in ''​my.cnf''​ and restart the MySQL server).
 +Here is what the statistics look like in PhpMyAdmin:
 +{{ :​2_7_0:​admin:​mysql-keyreads-stats.png?​direct&​600 | MySQL Key reads in PhpMyAdmin}}
 +===== Check the Query Cache =====
 +Check if the MySQL Query Cache is enabled, with enough memory to cache the results of the most common queries.
 +Here is what the Query Cache status looks like in PhpMyAdmin:
 +{{ :​2_7_0:​admin:​mysql-query-cache-stats.png?​direct&​600 |MySQL query cache in PhpMyAdmin}}
 +===== Remove un-needed dictionary files =====
 +<note tip>No more needed since iTop version 2.3.1</​note>​
 +Using iTop in your language is great, but do you really need Turkish, Spanish, Russian and Chinese on your system? If the answer is no, then you can free a good amount of memory that will be used for more productive purposes. Moreover, if you don't have APC installed on your system, all these dictionaries are loaded on each page request. To remove the non-needed dictionaries,​ the easiest way is to remove the files (they are called XX.dictionary.YYYY.php,​ where XX is the language code) from the datamodels directory and to run the setup again.
 +Another way to remove the dictionaries is to edit the iTop configuration file and to comment out (or remove) the lines corresponding to the dictionaries. Be aware however that the list of included dictionaries will be recomputed the next time you run the setup.
 +For example, keeping just the English, French and Italian translations:​
 +<code php>
 +       '​dictionaries'​ => array (
 +                //'​dictionaries/​ru.dictionary.itop.ui.php',​
 +                '​dictionaries/​fr.dictionary.itop.core.php',​
 +                '​dictionaries/​it.dictionary.itop.core.php',​
 +                // '​dictionaries/​zh.dictionary.itop.core.php',​
 +                // '​dictionaries/​zh.dictionary.itop.ui.php',​
 +                // '​dictionaries/​es_cr.dictionary.itop.core.php',​
 +                // '​dictionaries/​ja.dictionary.itop.ui.php',​
 +                // '​dictionaries/​es_cr.dictionary.itop.ui.php',​
 +                // '​dictionaries/​hu.dictionary.itop.ui.php',​
 +                // '​dictionaries/​ru.dictionary.itop.core.php',​
 +                // '​dictionaries/​ja.dictionary.itop.core.php',​
 +                '​dictionaries/​dictionary.itop.core.php',​
 +                '​dictionaries/​dictionary.itop.ui.php',​
 +                // '​dictionaries/​tr.dictionary.itop.ui.php',​
 +                // '​dictionaries/​de.dictionary.itop.ui.php',​
 +                // '​dictionaries/​de.dictionary.itop.core.php',​
 +                // '​dictionaries/​pt_br.dictionary.itop.core.php',​
 +                // '​dictionaries/​pt_br.dictionary.itop.ui.php',​
 +                // '​dictionaries/​tr.dictionary.itop.core.php',​
 +                '​dictionaries/​fr.dictionary.itop.ui.php',​
 +                '​dictionaries/​it.dictionary.itop.ui.php',​
 +                // '​dictionaries/​hu.dictionary.itop.core.php',​
 +                '​env-production/​authent-ldap/​fr.dict.authent-ldap.php',​
 +                '​env-production/​authent-ldap/​it.dict.authent-ldap.php',​
 +                '​env-production/​authent-ldap/​en.dict.authent-ldap.php',​
 +                // '​env-production/​authent-ldap/​pt_br.dict.authent-ldap.php',​
 +                // '​env-production/​authent-ldap/​de.dict.authent-ldap.php',​
 +                // '​env-production/​authent-ldap/​es_cr.dict.authent-ldap.php',​
 +                ...